i need some help
which is when i on my index.ctp/view.ctp, i need to call to my controller function to perform some task. what code i can use to perform this action?
- i need to call to my controller function, which send in a value (user_id) to the function and get me a certain action. how can i do that? i might calling in a javascript function as well.
If you need to call a Controller function from the View, you’re doing it wrong. It’s not proper MVC.
Having said that,
requestActionwould be the proper, albeit slowest way to do so. You could hack around a bit more and get an instance of the Controller from theClassRegistry. But I’d seriously recommend you to restructure your program flow so you don’t need to do this to begin with.