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?
views:
49answers:
1
+1
A:
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.
Dave Jones
2009-11-21 21:01:32
renderElement() is deprecated (resp. no longer exists in the coming 1.3 release), use element() instead.
dhofstet
2009-11-22 07:05:52
Thank you Dave, I'm working in this way. I just work to remove the requestAction because at the end with a few changes I need a form without any previous logic in a controller.
jald
2009-11-23 16:05:16