Reputation: 11
I want to use the view for one controller action inside another view with CakePHP, and passing some variables. Anybody has been work on this situation or something similar?
Upvotes: 1
Views: 147
Reputation: 45
I think I understand what you're attempting, but I'm pretty sure it's not directly possible - as you've found.
What I tend to do in this situation is find the amount of code I want to replicate in both views, put it in an element and then call $this->renderElement('path-to/element')
inside both views.
You could do something with $this->requestAction('controller/function')
but it carries a large overhead.
I would suggest considering reformatting your code and using the element suggestion above.
Upvotes: 1