links with php

#1
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=...."
 
#2
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 posts

Latest profile posts

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 https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,970
Messages
673,298
Members
89,016
Latest member
Poseeut