if the version of cakephp is 2.1
// in /app/Controller/AppController.php
public function beforeFilter(){
$this->set('controller',$this->params['controller']);
$this->set('action',$this->params['action']);
}
// in /app/View/Latyouts/default.ctp
echo 'Controller: '.$controller.'Controller.php'.'<br />';
echo 'View: '.$action.'.ctp';
2012/5/2 Tilen Majerle <tilen.majerle@gmail.com>
in your __construct() method for component, first parameter is ComponentCollection $collection object.From here you can store controller to component like$this->Controller = $collection->getController();then params you have in $this->Controller->params
--Lep pozdrav, Tilen Majerle
2012/5/2 Cruisine <cruisine87@yahoo.co.id>hi guys...i need to know how to get current controller from cakephp
component....
i tried to use $this->Params['controller'] on my component but it
keeping me get error message like this :
Notice (8): Undefined property: DynRubrikComponent::$params [APP
\controllers\components\dyn_rubrik.php, line 17]
do u guys know how to deal with this matter ? need ur help very
soon...thank u..
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment