@romel
first error: he wants it in a component - not the view
second issue: the request object should be used for this. not the controller itself (that used to be this way in 1.x)
(as for right now it still works (readonly) but might be deprecated in later versions anyway)
and last error: beforeFilter is only triggered on valid request. so it might break. always use beforeRender() for passing stuff like that to the view
but since its irrelevant to this thread..
Am Mittwoch, 2. Mai 2012 13:44:51 UTC+2 schrieb romel javier gomez herrera:
hi!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