ID:185024
 
I remember some thing I used to do where it was like on my main page I would put and then in the page links I would make them http://blah/main.php?page=blah.html or something, I was wondering if anyone knew the actual codes I use to do this?
PHP includes work like this: (I'm using DM tags here, but the code is PHP.)

<?php
include('blah.html');
?>


If that's all you're going to use PHP for (just including files), then that's a bit wasteful to be loading up PHP every time accesses a webpage; you could use server-side includes instead, which are faster. (Google it.)
In response to Crispy
He wants to be able to use get(Or is it post, I always get confused) data to load a page. That way all he has to do is create a template "shell" page, then put the important content in the middle, nomatter what it is.

This does have some security issues though. I figured out how to use this to create a loop which would crash my site(Well, bring it to a standstill for everyone on it). So I just had to mess with some basic checks and fixed the problems.

By default, PHP doesn't allow for Get data, it must be enabled though config files. If you are using a 3rd party host, you are probably fine, but make sure you put in those checks. If you don't know how to do this, then you needs to learn more PHP.

This, much like DM, needs to be learned, not just handed over.
In response to Scoobert
Okay thanks, guess I may have to learn. Right now I know nothing of PHP. I just remember awhile ago I did this with an older site, now I can't remember how.
In response to Himari
http://codewalkers.com/

Most of the PHP I know came from that site and the PHP reference.
I think he's talking about this:

http://www.totalchoicehosting.com/forums/lofiversion/ index.php/t19436.html

I couldn't think of it off the top of my head, so I used trusty ol' google and searched what I remembered (php navigation switch)

Basically:

<?php
switch($id) {
default:
include('main.htm'); //put the url for ur newspro or something
break; case "blah": //put the name u want the page to be an same for the rest
include('blah1.htm'); //put the url for another page an same for the rest
break; case "blah2":
include(blah2.htm');
break; case "blah3":
include('blah3.htm');
break; case "blah4":
include('blah4.htm');
break; case "blah5":
include('blah5.htm');
}
?>

And when you make a link, ya put in the url such as test.php?id=blah


I don't really have time to test since I am at school, but I hope this works.
In response to King Gunnerblast
This seems like a bad way to do it. This would require an update of the PHP file every time you want to allow for a new page. The idea of strictly restricting pages based on a list is a decent one, but doing it that way is not. I would recommend a list of acceptable pages inside of A. a database or B. another html/text file parsed by php. I realize that both of these are probably far over his head, and really over mine at this moment(I haven't touched php in months).

also:
<?php
$page = 'main.htm'
switch($id) {
case "blah";
$page='blah.htm';
case "blah2";
$page='blah2.htm';
}
inclue($page);
?>


Seems like a better way of doing it inside of the PHP file, but I guess it doesn't matter.
In response to Scoobert
Oh, I see. That makes more sense.