Hi,
thanks for the expaination, just one more question, how come then that
adding
$this->mName=$this->modelName;
to a function does correctly assign the $modelName var to $mName? is
there a difference between reading and setting $this-> ?

thanks
Marco


On Oct 17, 11:52 pm, Ant Cunningham <ant.cunning...@gmail.com> wrote:
> In the context of an action $this->$var refers to the variable container
> for the resulting view, not the the Actions class instance itself (check
> out the __get and __set magic methods for sfComponent). The view then
> gets local access to everything in its variable container. By defining
> the varibale as a public member to your actions class you are not
> assigning it to the view... only the Actions.
>
> mbernasocchi wrote:
> > hi, I'd like to expose a variable (the name of the model used by a
> > module) from the action to the template so that I just have to define
> > it once for the whole class.
> > If I do
> > [code]
> > class openmodelActions extends sfActions
> > {
> >   public $modelName='OpenModel';
> >   public function executeIndex(sfWebRequest $request)
> >   {
> >     $this->mName=$this->modelName;
> >     $this->categories = Doctrine::getTable('Category')
> >       ->getWithBubbles($this->modelName);
> >   }
> > }
> > [/code]
> > and <?php echo $mName;?> in the template it works. But if I don't do
>
> > $this->mName=$this->modelName;
> > in the execute index and call <?php echo $modelName;?> in the
> > template, I get a variable undefined warning.
>
> > any Ideas?
> > Tanks Marco
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to