Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

73 users online



Tutorial: page.php?page=blah / query strings / easy template tutorial (UPDATED)

Tutorial: page.php?page=blah / query strings / easy template tutorial (UPDATED)

Currently viewing this thread: 1 (0 members and 1 guests)


Page 15 out of 15
easy

easy

Status: Offline!

Re: Tutorial: page.php?page=blah / query strings / easy template tutorial (UPDATED)

Quote:

Originally posted by Phil

Way one, if you intend to have other query string variables besides just ?page

PHP:


<?php

if( isset($_GET['news']) and !defined('PAGE_LOADED') ) {
     include 
'pages/news.php';
     
define ('PAGE_LOADED''');
}
if( isset(
$_GET['portfolio']) and !defined('PAGE_LOADED') ) {
     include 
'pages/portfolio.php';
     
define ('PAGE_LOADED''');
}
if( isset(
$_GET['forum']) and !defined('PAGE_LOADED') ) {
     
define ('PAGE_LOADED''');
     
header("Location: forum.php");
}
?>


great stuff for a php novice like myself! but, in the above example, how do I add the default page? and what does header ("Location: forum.php") do?

thanks Wink

agk

agk

wat
Status: Offline!

redirects to the specified direction, in this case is "forum.php"

___________________

WARNING: It's in Spanish.

Phil

Phil

with Mr. Jones
Status: Offline!

Bump; we need it

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

bleedwithme

bleedwithme

i do my crosswords in pen
Status: Offline!

Are you ever going to make a tutorial about URLs like index.php?article=23&page=4 ?

ewker

ewker

Neverside Newbie
Status: Offline!
PHP:

<?php
elseif (!isset($_SERVER['QUERY_STRING'])) {
     include 
'includes/home.php';
}
?>


sorry about replying to such an old topic, but i have found that code to work for the default page.

___________________

http://www.ewker.com

Page 15 out of 15
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0095 seconds.