hey chris,

try beforeFilter().

runs prior to every action, you can set values there and they will be
available in our layout.

have fun
freedom

On 07/09/06, Chris <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I wanted to change the menu class in my defualt.thml file. here is my
> controller:
>
> class PostsController extends AppController
> {
>     var $name = 'Posts';
>     var $pageTitle = 'Test of the page title stuff';
>     $this->set('MenuSelected', '2');
>     function index(){
>         $this->set('posts', $this->Post->findAll());
>     }
> }
>
> with it like this I get:
> Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> in /home/schools/public_html/cake/app/controllers/posts_controller.php
> on line 7
>
> but if I change the class to:
> class PostsController extends AppController
> {
>     var $name = 'Posts';
>     var $pageTitle = 'Test of the page title stuff';
>     function index(){
> $this->set('MenuSelected', '2');
>         $this->set('posts', $this->Post->findAll());
>     }
> }
>
> it works fine.
>
> Does this mean I have to set all of the default.thtml vars in each
> function?
> index()
> view()
> add()
> delete()
> update()
>
> ?
>
> this seams like a lot of extra work,  how do I set vars to be used in
> the layout views like done with pageTitle?  were you set it once up top
> and all the veiw functions use the setting?
>
> Thanks
> Chris
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to