Not sure, but I read somewhere that this will not be possible anymore
to access controller in view, cause it breaks MVC rules.
Any expert to confirm or not?
On 19 mar, 18:35, "Gilles Dubois" <[EMAIL PROTECTED]> wrote:
> Version : CakePHP version 1.2.0.4451alpha
>
> The class constructor is waiting for an argument name $controller. The
> class has an attribute $controller. In previous versions, I was used
> to reach the controller from the view (eg in a .thtml file) using
> $this->controller. It doesn't work anymore with out-of-the-box CakePHP
> version 1.2.0.4451alpha.
>
> So I modified the View constructor to add : $this->controller =
> $controller; as shown below (third line) :
>
> function __construct(&$controller) {
> if(is_object($controller)) {
> $this->controller = $controller;
> $count = count($this->__passedVars);
> for ($j = 0; $j < $count; $j++) {
> $var = $this->__passedVars[$j];
> $this->{$var} = $controller->{$var};
> }
> }
> parent::__construct();
> ClassRegistry::addObject('view', $this);
> }
>
> Is it a bug ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---