How to create Helper File |
[eluser]BD-CI-Programmer[/eluser]
Step # 1 Create a file at your helpers folder (system/helpers). File name will be filename_helper.php like this. Now let create a file name test_helper.php and save it on your helpers folder. Code: <? Step # 2 Create a controller (test_help.php) on you controller folder. Code: <?php Now run the application http://localhost/ci/index.php/test_help Out Put will be “I am Nahid”
[eluser]wiredesignz[/eluser]
Please correct your mistakes, helpers should be located in application/helpers not system/helpers, the Controller class name must be ucfirst ie: Test_help and echo $str = hello_nahid(); may be valid but it is not good style for a tutorial. The helper is also echoing a value rather than returning it to the Controller which makes the echo in your Controller redundant. Not a very helpful helper at all. Thanks.
[eluser]xwero[/eluser]
BD-CI-Programmer rewriting the user guide to make topics is not a good way to create forum karma. You should have learned that from your post on libraries. If you like to write tutorials make them about what isn't in the user guide or already on the forum. |
Welcome Guest, Not a member yet? Register Sign In |