Sunday, July 26, 2009

Re: 'set' and 'render' together? access set variables from different view?

Brian the actual variable is $a, no underscores.

Maybe I wasn't clear in my earlier post.

e.g.

//exampleController - someaction

$a = 'a';
$this->set('a', $a);
$this->render('differentaction');

//differentaction.ctp

<?php echo $a ?>;

Should this work?

On Jul 26, 11:00 am, brian <bally.z...@gmail.com> wrote:
> Is there an underscore in the actual variable name?
>
> On Sun, Jul 26, 2009 at 12:40 AM, Josh<joshs.silver...@gmail.com> wrote:
>
> > This seems like a very simple question, but I have been struggling
> > with it for quite a while. How can I use the 'set' function and then
> > the 'render' function while still being able to access my set
> > variables from the view? It seems to me that 'set' only makes
> > variables available in the view that matches the action. How can I get
> > around this?
>
> > e.g.
>
> > //exampleController
>
> >                $this->set('a', $a);
> >                $this->render('index');
>
> > //index.ctp
>
> >                <?php echo $a ?>;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: