@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)
http://book.cakephp.org/2.0/en/controllers/request-response.html#cakerequest
(as for right now it still works (readonly) but might be deprecated in
later versions anyway)
but - concerning the view - why passing it on to the view manually? the
view also has the request object and therefore this information
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 <[email protected]>
>
>> 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
>> http://majerle.eu
>>
>>
>>
>> 2012/5/2 Cruisine <[email protected]>
>>
>>> 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
>>> [email protected] 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
>> [email protected] 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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php