Re: Get a controller method from template

2006-07-31 Thread John David Anderson (_psychic_)


On Jul 31, 2006, at 9:06 AM, alepane wrote:

>
> I have to get in a template some code generated from a controller
> (Lavoro).
> I have write:
> Cliente :  $this->controller->Lavoro->getLavoro(); ?>
> But php return an error :
> "Fatal error: Call to a member function on a non-object in
> c:\programmi\easyphp1-8\www\app\views\layouts\default.thtml on line  
> 47"
> Why ? How I have to do ?

You need to have your controller generate the code and hand it to the  
view in a variable, using the set() function. In your controller, do  
something like this:

$this->set('code', $this->Lavoro->getLavoro());

And in your view, do:



-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Get a controller method from template

2006-07-31 Thread alepane

I have to get in a template some code generated from a controller
(Lavoro).
I have write:
Cliente : controller->Lavoro->getLavoro(); ?>
But php return an error :
"Fatal error: Call to a member function on a non-object in
c:\programmi\easyphp1-8\www\app\views\layouts\default.thtml on line 47"
Why ? How I have to do ?
Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---