In the past, I've been creating my apps with basically a view (i.e. search.php or display.php) and a large file with a bunch of functions (i.e. library.php). I intend to change all this by going the MVC route w/o a framework. I just don't have time to learn a new framework, I want to get this done and do my best to separate the php code from my html code. If I can accomplish that, I'm happy. Anyways, how does one deal w/ the following? I think I've been doing this the wrong way ever since I started making user membership type sites.
Let's take stackoverflow for example. A guest visitor sees a "Login" page at the top of the header. Once you log in, the "header" changes to display menus that are relevant to a member of the site. In this case, I see my username and a logout link (along with a few others). What I've done in the past is take my header.php (I include it into my main page) and with a few if/else statements, I display it depending on whether a user is log in or not.
I found an example somewhere (dont recall), that had two separate views. If it's a guest user, display a different header from someone who is logged in. My code gets very messy if I have to keep track if a user is log in or not and having to display the correct view for the user.