Andrew R Posted August 16, 2006 Share Posted August 16, 2006 I need some help on creating a PHP navigation script that uses the home page (index.php) as a template for the other pages on the site. I know plenty of scripts that will give me, index.php?view=home, but I can’t get them to work without getting errors if I’m using sessions on my page, i.e. for a login or a user area. Anybody know any scripts that will allow me to use a PHP Navigation and sessions (session_start();) etc?Here’s the current script I’m using to get [code]<?$content = $_REQUEST['view'];if($view == "") {$view = "home";} ?>[/code][code]<?include "$view.php"; ?>[/code]Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/ Share on other sites More sharing options...
redarrow Posted August 16, 2006 Share Posted August 16, 2006 why not include the nav and banner from a header.php page. Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/#findComment-75954 Share on other sites More sharing options...
ToonMariner Posted August 16, 2006 Share Posted August 16, 2006 Write one!it would be quicker to help you out with the errors you are getting than to point you to any scripts that you would have to customize...... Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/#findComment-75956 Share on other sites More sharing options...
sasa Posted August 17, 2006 Share Posted August 17, 2006 change line [code]$content = $_REQUEST['view'];[/code]to[code]$viev = $_REQUEST['view'];[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/#findComment-76102 Share on other sites More sharing options...
Andrew R Posted August 17, 2006 Author Share Posted August 17, 2006 Cheers "sasa"The errors I'm repeatedly getting are, Warning: session_start(): Cannot send session cookie - headers already sent by (output started at ................).I have been reading around on this forum and I believe the session_start() has to be on the index page although I’m not sure if I do this it will make my site less secure?I’m also getting problems submitting forms with $_SERVER['PHP_SELF'] using index.php?view=…. Any idea on how to submit forms using $_SERVER['PHP_SELF'] with the php navigation I'm using?Help would be much appreciated Cheers Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/#findComment-76403 Share on other sites More sharing options...
HeyRay2 Posted August 17, 2006 Share Posted August 17, 2006 [b]session_start()[/b] needs to be the first thing in your PHP files, before any output is sent to the browser...[code]<?phpsession_start();// All your other code?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17784-php-navigation-indexphpview/#findComment-76406 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.