[Phpwm] Site Structure

Our Friend Bernard ourfriendbernard at yahoo.co.uk
Fri Dec 9 11:24:44 GMT 2005


  you could always put the header code above the rest of the code and html.
   
  A bit of code/ammendments to your page.
   
  <?php
   
  $filename = '/path/to/files/directory/on/server/';
  
if (isset($_GET['page'])) {
   $page.=".php";
   
     $filename.=$page;
     if(file_exists($filename)) {
        include("$page");
     }
     else{
        include("notfound.php");
     }
}
else {
include("welcome.php");
}
?>

  

Matt Harris <mharrisweb at yahoo.co.uk> wrote:
  Hi Folks,

Hope your all ok.

I was after some basic advice, regarding setting up my site using php (this is my first php project).

I have my index page with two divs, one for the menu and one for the content where I pull in the different pages, by setting a variable thats the name of the page, in the url. Below is the code I have in my index.

<?php
if (isset($_GET['page'])) {
$page = $page . "." . "php";
include("$page");
}
else {
include("welcome.php");
}
?>

This works fine, but if I want to redirect the user to a different page using the header function, I get an error because there is html on my index page, before the php code.

How do you guys go about setting up your sites in a resourceful way?

Am I just better off sticking to including a header and a footer on all my pages?

Any advice would be much appreciated.

Many thanks.

Matt
    
---------------------------------
  Play Santa's Celebrity Xmas Party, an exclusive game from Yahoo! _______________________________________________
Phpwm mailing list
Phpwm at mailman.lug.org.uk
http://mailman.lug.org.uk/mailman/listinfo/phpwm

  



		
---------------------------------
Yahoo! Messenger  NEW - crystal clear PC to PC calling worldwide with voicemail 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20051209/a7c8113d/attachment.html


More information about the Phpwm mailing list