Jump to content

Archived

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

Recommended Posts

Hi, very new to php, and in need of some help :(

 

http://www.renegadesofdeath.co.uk

Thats my clan website for a game i play

 

But more to the point, im having trouble getting the php to open any new pages (from the links on the left) to open in the main page.

 

if($id) { include("$id.php"); } else { include("home.php"); }

 

Thats all the php in the main page is. Im not sure how to add to it or anything. I want so that any links that are clicked on will appear where the homepage is.

 

Sorry if this has been asked before, and any help is appreciated. Thanks :)

 

RoB

Share this post


Link to post
Share on other sites

I'm not sure on this but from what i've seen just put that part in where all the info goes on the home page and it should show up there.

Share this post


Link to post
Share on other sites

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<?php

[/span][span style=\"color:#FF8000\"]//Use the switch() to set up navigation

[/span][span style=\"color:#007700\"]switch([/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'id\'[/span][span style=\"color:#007700\"]])

{

     case [/span][span style=\"color:#DD0000\"]\'1\'[/span][span style=\"color:#007700\"]:

     {

          include([/span][span style=\"color:#DD0000\"]\'page1.php\'[/span][span style=\"color:#007700\"]);

     }

     break;

 

     case [/span][span style=\"color:#DD0000\"]\'2\'[/span][span style=\"color:#007700\"]:

     {

          include([/span][span style=\"color:#DD0000\"]\'page2.php\'[/span][span style=\"color:#007700\"]);

     }

     break;

 

     default:

     {

          include([/span][span style=\"color:#DD0000\"]\'home.php\'[/span][span style=\"color:#007700\"]);

     }

     break;

}

[/span][span style=\"color:#0000BB\"]?>[/span]

[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

 

Then have your menu set up like "index.php?id=1" and it will load page1.php.

 

Jeremy

Share this post


Link to post
Share on other sites

After the break I would add "default: include("index.php");" so that so when you go to your main page you don't have to type ?id=1 in it.

 

Oops didn't see you had it there because I don't usualy use the break after doing the defualt.

Share this post


Link to post
Share on other sites

Its sorted now :)

 

I got a footer.inc and a header.inc

 

put the index.php script into the header.inc and added the include header.php thing at the top of every php page i wanted to link from. Thanks for the help guys. If you want any more info on how i did it i'll write a small know how on another post if you like :)

 

Thanks for the help anyhoo guys. Appreciated

 

EDIT: I was looking at the countdown timers for php scripts on this site... anyone know of any that go the minute? or the second even? or how to edit those that are there to do that?

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.