I can't seem to find a method to call different controller in the same view. The closest thing I've found is $html->link("Register User",array('controller' => 'users', 'action'=>'register')).
So I did the cakephp's blog tutorial. I have a posts_controller.php
, and now I want to add in a star rating system. I googled some stuff and got this nifty-already-been-done rating system you can download: http://www.reversefolds.com/articles/show/rating2
Now I have two controllers, rating_controller.php and post_controller.php.
My base route, '/', is pointing to post controller's index action. My post's view.ctp is showing one blog entry, I want to add in the rating system within this view. And to use the rating I need to call the helper like so:
echo $rfRating->ratingBar($ratingInfo);
When I do this in post's view.ctp file. It complains. I've tried messing around with var $helpers = array('blah')
but it didn't work, I just end up merging the rating controller in the post_controller, which I think is stupid. I can use the rating system for other stuff too.
So... I don't know what to do. Actually that's a lie, I think I two idea how to tackle this. But I need critiques and other solutions that my google skills have failed.
Should I just implement the whole rating system into the app_controller.php instead? So that every controller inherit this rating system? Sounds stupid because I don't think my user registration needs the rating system.
I've googled up another solution,
requestAction('blab')
. I think what this enable me to do is... to call another controller within a controller. But this is frown upon cause it kills performance. And I don't exactly know how to do this haha or if it works. I call the rating controller but what about its helper function? Maybe it'll recognize it if I add a var $helpers = array('rating');
Anyway, thank you all in advance for taking the time to read this. Please point me in the right direction.