Hey Francois,

you can also use a filter do set this globally.

Daniel



On Dec 16, 5:11 am, François CONSTANT <[email protected]>
wrote:
> Hi,
>
> well because all the titles in this application are set up in the
> view.yml files. Furthermore I think that the title is part of the
> view, not of the control; I just access a user's attribute to add it
> in the title...
>
> If I needed some tests, I would move that to the action.
>
> On 16 déc, 11:49, "Brandon Olivares" <[email protected]> wrote:
>
> > Hi,
>
> > Why not just set the title in the action? Seems a bit cleaner if you want a
> > dynamic title. I try to keep PHP out of the YAML files as much as possible.
>
> > Brandon
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]
>
> > On Behalf Of François CONSTANT
> > Sent: Tuesday, December 16, 2008 5:45 AM
> > To: symfony users
> > Subject: [symfony-users] Re: Use sfUser attribute in view.yml
>
> > That sounds obvious now, it does work :)
>
> > To sum it up, if someone wants to do the same just put at the begining
> > of the yaml file :
> > <?php
> >         $sf_user = sfContext::getInstance()->getUser();
> > ?>
> > Then you can use $sf_user exactly in the same way than in a template.
>
> > I just got started with Symfony so I work with 1.2.
>
> > Many thanks,
>
> > On 16 déc, 11:36, Alexander Deruwe <[email protected]> wrote:
> > > On 16 Dec 2008, at 11:34, François CONSTANT wrote:
>
> > > > I would like to get a user attribute in view.yml (in order to modify
> > > > the title).
>
> > > > I know that I can use some php in this file but what I don't know is
> > > > how to access the sf_user object. Within an action I could use $this-
> > > >> getUser() and set up a new config variable but I'm sure there is a
> > > > way to access this user object in the view.yml.
>
> > > I think you'll need to get the context first (I'm talking about 1.0  
> > > here, it's the only version I use):
>
> > > $context = sfContext::getInstance();
> > > $user = $context->getUser();
>
> > > This should work I think but I've not tested it.
>
> > > Alexander
--~--~---------~--~----~------------~-------~--~----~
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