Hi Mohammad, The action classes use the PHP magic __set() method, which is only used when an object member has NOT been defined yet. So the answer you're looking for is no. If you'd like to have certain variables set in every action in a module, consider using the ->initialize() or - >preExecute() method (the latter is not called when validation fails).
This may shed some light on the matter: http://trac.symfony-project.com/browser/branches/1.0/lib/action/sfComponent.class.php#L252 Kris On Jun 13, 10:02 am, "Mohammad Ali Safari" <[EMAIL PROTECTED]> wrote: > Thanks Eno. > My exact question is can I define a variable in my action class OUT OF my > action FUNCTION and still access it in my template? > > cheers, > --mohammad > > On Fri, Jun 13, 2008 at 10:57 AM, Eno <[EMAIL PROTECTED]> wrote: > > > On Jun 13, 11:13 am, "Mohammad Ali Safari" <[EMAIL PROTECTED]> > > wrote: > > > > I am defining a variable in my action class like this: > > > > class myActions extends sfActions > > > { > > > public $var > > > ... > > > > I assume that I have access to variable $var in any of my templates, but > > it > > > is not the case. The only thing I could do is to have $this->foo = > > > $this->var in my corresponding action function and access $foo in my > > > template. > > > > Am I wrong that templates have access to all public variables defined in > > the > > > action class? > > > Yes. > > > :-) > > > If you want $foo in your template you need to set $this->foo in your > > action. > > > -- --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---