This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

App layout still visible when sfGuard user is logged out?

Questions relating to sfGuardPlugin or other user management plugins

App layout still visible when sfGuard user is logged out?

by Jakobud » Tue Aug 23, 2011 11:42 pm

First of all, I'm new to Symfony, so its possible that I'm simply approaching things the wrong way:

I have an application secured using the sfDoctrineGuard plugin. The way I have my templates/layouts is like this:

I have a single application layout. It has my <html>, <head>, etc in it. At the top of the body, I have a header partial that I include. This header has a logo and a menu system etc.

So each module's template is set within the application layout. Therefore each page I view has the header and menu and stuff from the partial. I assume this is the proper way to approach Symfony layout/template design?

Anyways, I've now added the sfDoctrineGuard plugin to my app. The problem I'm having is that when the user is logged out, they still see the header and menu and stuff. I don't want the user to see those things if they aren't logged in. What is the traditional approach to this problem? Am I approaching the layout/template design incorrectly?

I can obviously just check if $sf_user->getGuardUser() != NULL before displaying the menu and header, but I figured I'd ask here first in case there is a bigger problem with my design. Alternatively, can I force sfGuard to use a different application layout instead?

I'm really not sure what the best approach is.
Jakobud
Junior Member
 
Posts: 27
Joined: Mon Jun 27, 2011 11:02 pm