I'm not sure, but why don't you try putting $category_list in your
session variable?
$this->Session->write('List', $category_list) would work fine.
On Jul 23, 7:47 pm, eiji <[EMAIL PROTECTED]> wrote:
> hi everyone,
>
> help. this is my first time to post here and i have just run out of
> thoughts on how to make this work.
>
> firstly, i wanted to have a menu that has a "Products" menu. and when
> the Products is clicked, a list of categories is then displayed, i
> plan to have this as an invisible div-ul-li that when the products is
> clicked it visibles it under the products menu (hope i made this
> clear).
>
> now im having a problem with getting a constant variable that would be
> visible to the layout everytime. at first i didnt know where to put
> the code. after reading a lot of posts here in the groups this is what
> i came up with, i had a variable, $this->set('category_list',...) in
> beforeFilter/beforeRender. But when im going to access it in the
> layout, it gives me an error. I tried to do pr() on the category_list
> in the layout it throws a "Undefined variable: category_list".
>
> can anyone help with my problem?? or can anyone suggest like where to
> put a global something that is always called?? o btw, heres my snippet
> on the beforeFilter/beforeRender.
>
> function beforeFilter() {
> if (isset($this->params['admin']))
> $this->layout = 'admin_default';
> if (!isset($this->params['admin'])) {
> echo 'x';
> $this->set('category_list',
> $this->Category->generateList(null, 'name ASC', null, '{n}.Category.id',
>
> '{n}.Category.name'));
> }
> }
>
> the echo 'x' there is just to test if it enters my condition, and it
> does. im just wondering why the category_list isnt being available in
> the layout..
>
> thanks for the help. :D
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---