I'm working on a system that has a protected part. Users have to login in order to be able to go there. Now I was wondering how I should handle the layout in a DRY way. All pages have the same layout with a header that contains either a few options and a login part or the full stack of options. How should I code that layout in order to have a nice DRY layout? I want to avoid to do checks on being authenticated in every layout. I prefer to have a single template (with a fixed header and footer) for the entire site that would be "automagically" included and rendered for users that are authenticated and not authenticated at once. I guess this is a quite normal question but I can't find an article that also discusses the layout organisation (ie which file should I place where).