links with php

CHiLLaXen

hypnotika
Joined
6 Jan 2004
Messages
107
Ok, I have a site that uses some php coding. The problem is that I want to create one page that generates everything. I want it to get the info from the url and produce the right content. Say like, I have a index.php (which loads the stuff I posted when you first enter) file and there is a link to the faq page, I want to click on the link ( something like <a href="index.php?faq>faq</a>)

then the index.php file will produce the faq file instead of the stuff I posted.

do you get what I'm saying? sorry, I really think of a way to explain it.

Well kinda like the ntfs main page, the links are like

"index.php?action=news&catid=...."
 
Yeah, so basically you divide your index.php page into blocks of code, such that each block generates code for a certain section.
Your links would look something like index.php?page=faq or index.php?page=images and so on.

Your index.php page would then look something like:
Code:
if($page == faq) {
 // All the code generated specific to the FAQ page
}
else if ($page == images) {
 // All the code generated specific to the Images page
}
else {
 // The page that should be displayed by default if no variable is passed 
}

You could also use a switch/case structure rather than if/else if you feel more comfortable with that.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie Electronic Punk Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. 🙁

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk Sazar Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,016
Messages
673,499
Members
5,630
Latest member
REALMTBENJOYER
Back