CodeIgniter Forums
It is possible to create new helper instead of extending them ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: It is possible to create new helper instead of extending them ? (/thread-41423.html)



It is possible to create new helper instead of extending them ? - El Forum - 05-07-2011

[eluser]Rushino[/eluser]
Hello,

It is possible to create new helper instead of extending them ?

Thanks.


It is possible to create new helper instead of extending them ? - El Forum - 05-07-2011

[eluser]davidbehler[/eluser]
Sure, just place a file with the name of your helper in /application/helpers and add it to the autoload config file/load it manually.

E.g. place a file called debug_helper.php in /application/helpers with this content:
Code:
<?php
  function pre($var)
  {
    echo '<pre>';
    if(is_array($var)) {
      print_r($var);
    } else {
      var_dump($var);
    }
    echo '</pre>';
  }
?&gt;
Now you can either load the helper via $this->load->helper('debug'); or add it to application/config/autoload.php config.


It is possible to create new helper instead of extending them ? - El Forum - 05-07-2011

[eluser]Rushino[/eluser]
Thanks dude work like a charm.