Welcome Guest, Not a member yet? Register   Sign In
Should views call other views? (e.g. header, footer)
#1

[eluser]Unknown[/eluser]
I'm looking for a best practices sort of answer.

I have a header, footer views, etc.

This works fine for static content, but sometimes I want to display content dependent on the user.

For example if a user is logged in, I want to display links to profile, log out, etc. Or if the user is an admin, I want to display admin options.

Or should the controller always be calling header and footer views between every content view?
#2

[eluser]umbungo[/eluser]
Well someone can correct me if they feel otherwise but here is how i would do it.. its 'DRY' at least.

I use a 'view' file (which i have as a model.. i think it should be something else-- suggestion?) to which i pass a title and the name of the view file.. in that i load header, content(from variable) and then footer.

Add a conditional statement for another view file for logged in, or admin.




Theme © iAndrew 2016 - Forum software by © MyBB