Jump to content


Photo

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


  • Please log in to reply
5 replies to this topic

#1 Andrew R

Andrew R
  • Members
  • PipPipPip
  • Advanced Member
  • 158 posts
  • LocationIreland

Posted 16 August 2006 - 11:09 PM

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
<?
$content = $_REQUEST['view'];
if($view == "") {
$view = "home";
} 
?>

<?
include "$view.php"; ?>

Cheers.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 August 2006 - 11:32 PM

why not include the nav and banner from a header.php page.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 16 August 2006 - 11:33 PM

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......
follow me on twitter @PHPsycho

#4 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 17 August 2006 - 09:05 AM

change line
$content = $_REQUEST['view'];
to
$viev = $_REQUEST['view'];


#5 Andrew R

Andrew R
  • Members
  • PipPipPip
  • Advanced Member
  • 158 posts
  • LocationIreland

Posted 17 August 2006 - 07:44 PM

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


#6 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 17 August 2006 - 07:47 PM

session_start() needs to be the first thing in your PHP files, before any output is sent to the browser...

<?php
session_start();

// All your other code
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users