fefe fefe - 4 years ago 110
PHP Question

CodeIgniter helper in the view

Is it a good workaround and would it be possible to use helper classes in the view, in CodeIgniter. I have a situation when I have to extract with regulars expression from a text couple of strings and generate outputs on matches. I would not like to do this directly in the view and I would like to use for this purpose a helper.

application
--view
---myview.php


and here I should call the helper and return results

for example I want to extract from the text the type of processor, than I pass the text and get returned the processor type. This one is needed because all the data in the view are generated by an API dynamically.

echo $myhelper->processor($text);

Answer Source
get_instance()->load->helper('HELPER_NAME');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download