How call function in a view File |
Hey , Guys.
I have a function in Controller as follows: Path: controllers/category.php Code: public function get_category_name($parent_id=NULL) Now i want access that function product display page Path : view/products/index.php Code: $CI=&get_instance(); i have tried but the above code does not work , I am using Codeigniter 3.0.6. Please Me . Thanks
You need to pass the variables with the desired content to the view instead of the other way around. You can have a look at the docs: http://www.codeigniter.com/user_guide/tu...pages.html
You cam also create a CI helper file and add your code there then it is global to the whole app.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Additionally, if a function is only going to be used internally by your application, you don't want it to be a public method on a controller. Any public method in a controller is callable from the URL/browser unless you prefix the function name with an underscore.
|
Welcome Guest, Not a member yet? Register Sign In |