Can helper classes be used in CodeIgniter view? |
Is it advisable to use helper classes in CodeIgniter's view? I need to extract specific strings using regular expressions from a block of text and generate output on matches. I'm hesitant to do this directly in the view, and I'm wondering if I could use a helper class instead.
The structure of my application is: application --view ---myview.php I want to call the helper class and return the results in my view file. For instance, I need to extract the processor type from the text, so I pass the text to the helper class and get back the processor type. I need this because all the data in the view is generated dynamically by an API. Would it be a good approach to use the following koows code in my view? echo $myhelper->processor($text);
Once loaded, it becomes globally available in your controller and views.
Yes, you can use a helper in the view, look at the Form helper etc; Those are view helpers. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |