There is a way to use a controller action directly as an element in CakePHP?
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 开发者_如何学JAVAsimilar?
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.
加载中,请稍侯......
精彩评论