Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hot to do /index.php?page=news

Status
Not open for further replies.

AdRock952

Technical User
Feb 6, 2004
16
GB
I am trying to cut down the size of my website and know that I can use the index page as the layout and have content change for each page using the same layout (like using one page but changing the content).

What I am trying to achieve is something like where I can use one page and have different files with different content in each.

I have seen it before but can't remember the code for it. Can someone please help me out?
 
Use the switch() function. Example
Code:
<?
if (isset($_GET['page'])) switch ($_GET['page']) {
   case 'news':
//
//  output for 'news'
//
    break;
   case 'info':
//
//   output for 'info':
//
   break;
//
// etc...
//
}
?>
If your code for the different sections is large, I would suggest using include files or functions to make it easier to debug and write.

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top