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.

Forum statistics

Threads
62,021
Messages
673,242
Members
5,642
Latest member
osipov
Back
Top