Jump to content

Archived

This topic is now archived and is closed to further replies.

Andrew R

PHP Navigation (index.php?view=....)

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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......

Share this post


Link to post
Share on other sites
change line [code]$content = $_REQUEST['view'];[/code]to[code]$viev = $_REQUEST['view'];[/code]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[b]session_start()[/b] needs to be the first thing in your PHP files, before any output is sent to the browser...

[code]
<?php
session_start();

// All your other code
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.