PDA

View Full Version : PHP Code - HELP!


lance
03-21-2005, 03:34 PM
Hi!

I am having some trouble with the following code:

<?php
if(!$page || $page == "") {$pages = "default";} ?><?php include ("$page.html"); ?>

Now I've been told to replace "page" with something like an initial say e.g - site is called sims site then use ss. Then I was told to replace "default" with the page location which first appears when you go to the site with the ?no bit.

Are you lost? If not:

Then I was told to replace page.html with the extention of the pages you want the content to appear on e.g - so if my pages have the extension .php i'd have to add that....

But what I want to do is make one page and use this code so all that happens is the content changes, which would save me editting each menu on each page one-by-one...

Does anyone know PHP and can help? Oh yeah - Am I supposed to get rid of these >> " << because if so then im an idiot! lol!

ManagerJosh
03-21-2005, 04:33 PM
What's your objective Lance?

lance
03-22-2005, 07:04 AM
I want to make it so I don't have to edit each page individually. So what your supposed to do is add this code and then the whole website runs on one page but just the main content changes, where this code should be added....

Not sure if you understand that...

But, I dont know how to edit...

ManagerJosh
03-22-2005, 07:05 AM
So your talking more about Dynamic Content Pages? Or are you talking about includes, where you modify one set of pages, it modifies all pages with that file?

lance
03-22-2005, 12:22 PM
The second one..

Mirelly
03-22-2005, 02:19 PM
Give in Josh ... Lance doesn't want to answer in case he gives the game away. :p

ManagerJosh
03-22-2005, 04:45 PM
what you want is:


<?php

include "$page.html";

?>

lance
03-23-2005, 03:06 PM
Thanks Josh Its all working now... www.worldsims.simmedia.co.uk but it isnt finished..

ManagerJosh
03-23-2005, 03:22 PM
Erm, Lance, my suggestion is that you do NOT infringe on the WorldSims name.

Mirelly
03-23-2005, 11:53 PM
I agree with Josh. Lance are you also behind simmedia.co.uk? What is the connection between the two?

lance
03-24-2005, 01:47 PM
Yep I have changed the name after that letter this morning.

Thanks