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
-~----------~----~----~----~------~----~------~--~---