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=...."
 

NetRyder

Tech Junkie
Joined
19 Apr 2002
Messages
13,256
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 forum posts

Latest profile posts

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.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!
Perris Calderon wrote on Electronic Punk's profile.
EP, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there!

Forum statistics

Threads
61,991
Messages
673,360
Members
5,586
Latest member
amyseimetz

Affiliated sites