|
-
Jan 12th, 2004, 08:05 PM
#1
Thread Starter
Frenzied Member
include variable
this is a real dum question but I have a page called page.php now this is my template and has links to all other sections on the site. The links are page.php?ID=5 (or whatever)
In the middle of the page I want to add a include script which will allow whatever the ID is to be displayed.. can anyone help me with this?
-
Jan 13th, 2004, 12:51 AM
#2
Stuck in the 80s
What is the name of the files to be included, and what are their relation to the ID?
If they have the ID number in them, you can do something like:
Code:
include ('page' . $ID . '.php');
If you have certain IDs that stand for certain page names, you could do a case statement:
Code:
switch ($ID) {
case 0:
include 'this_page.php'; break;
case 1:
include 'that_page.php'; break;
case 2:
include 'other_page.php'; break;
default:
die('Invalid ID specified.');
}
Is this what you're looking for?
-
Jan 13th, 2004, 01:04 AM
#3
Thread Starter
Frenzied Member
Originally posted by The Hobo
What is the name of the files to be included, and what are their relation to the ID?
If they have the ID number in them, you can do something like:
Code:
include ('page' . $ID . '.php');
If you have certain IDs that stand for certain page names, you could do a case statement:
Code:
switch ($ID) {
case 0:
include 'this_page.php'; break;
case 1:
include 'that_page.php'; break;
case 2:
include 'other_page.php'; break;
default:
die('Invalid ID specified.');
}
Is this what you're looking for?
well it's a plain txt page which is kept in a folder... something like test1.php and test2.php then menu on my template have all the links which will be page.php?ID=whatever... in the page.php i have a include script which is fine if was just test1.php just it can change to all of the test1.php and test2.php depends on what page was loaded
-
Jan 13th, 2004, 09:15 AM
#4
Frenzied Member
I'm pretty sure he answered your question. You should only be putting the above switch statement or the simple include into your php file with nothing else if you just want to display the contents of the other file.
-
Jan 13th, 2004, 09:26 AM
#5
Stuck in the 80s
Originally posted by kiwis
well it's a plain txt page which is kept in a folder... something like test1.php and test2.php then menu on my template have all the links which will be page.php?ID=whatever... in the page.php i have a include script which is fine if was just test1.php just it can change to all of the test1.php and test2.php depends on what page was loaded
Like ober said, I pretty much answered your question, then.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|