Jump to content


Photo

Navigation


  • Please log in to reply
4 replies to this topic

#1 keeper.garrett1

keeper.garrett1
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationLeeds, England

Posted 26 June 2005 - 02:32 AM

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

#2 Matt B.

Matt B.
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2005 - 04:09 AM

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.
Matt B.
<?php echo "Hello World!"; ?>

#3 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 26 June 2005 - 08:12 AM

[!--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

#4 Matt B.

Matt B.
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2005 - 02:58 PM

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.
Matt B.
<?php echo "Hello World!"; ?>

#5 keeper.garrett1

keeper.garrett1
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationLeeds, England

Posted 27 June 2005 - 12:28 AM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users