Trium918 Posted May 7, 2007 Share Posted May 7, 2007 How do most of you handle the navigation of your site? I ask because I am trying to get my navigation bar to change after the user has logged in. Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/ Share on other sites More sharing options...
The Little Guy Posted May 7, 2007 Share Posted May 7, 2007 I have an if/else statement, and a session that is either TRUE or FALSE. If the session is TURE that means the person is logged in, if it is FALSE it means they are not logged in. session_start(); if($_SESSION['isLogged']){ // Place the Navigation if the user is logged in }else{ // Place the Navigation if the user is not logged in } I would place this in its own file, then include it on all the pages. Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/#findComment-247548 Share on other sites More sharing options...
benjaminbeazy Posted May 7, 2007 Share Posted May 7, 2007 My site employs navigation (carefully) based on the URL vars and my index file acts as a quasi-controller including requested pages. Originally, I stored my navigation info (i.e. heirarchy, visibility) in a table so my boss could control the page order and such. I have since abandoned that and created navigation file defining guest nav, as well as logged in nav for 3 different user types. The user access is determined by a session var pulled from the database upon log in. All protected pages start with a function call checking for the right credentials as defined in a security file included on each protected page. Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/#findComment-247570 Share on other sites More sharing options...
Trium918 Posted May 7, 2007 Author Share Posted May 7, 2007 I have an if/else statement, and a session that is either TRUE or FALSE. If the session is TURE that means the person is logged in, if it is FALSE it means they are not logged in. session_start(); if($_SESSION['isLogged']){ // Place the Navigation if the user is logged in }else{ // Place the Navigation if the user is not logged in } I would place this in its own file, then include it on all the pages. Ok, inside the code block are you using include() files with different <u><li><a href="index.php">Home</a></li></u> Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/#findComment-247574 Share on other sites More sharing options...
The Little Guy Posted May 7, 2007 Share Posted May 7, 2007 Somethting like this: <?php session_start(); if($_SESSION['isLogged']){ echo'<a href="index.php">Home</a> <a href="myPage.php">My Page</a>'; }else{ echo'<a href="index.php">Home</a> <a href="login.php">Log In</a> <a href="register.php">Register</a>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/#findComment-247585 Share on other sites More sharing options...
Trium918 Posted May 7, 2007 Author Share Posted May 7, 2007 Thanks The Little Guy! Quote Link to comment https://forums.phpfreaks.com/topic/50399-solved-site-navigation-with-php/#findComment-247592 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.