Jump to content

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

Link to comment
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

Link to comment
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.

Link to comment
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.