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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to