Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

92 users online



?page=webpage

?page=webpage

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


Stompy

Stompy

Status: Offline!

?page=webpage

Hello.

Tomorrow I will be coding two websites for personal use. Currently I have been using .shtml extensions but I want to adapt to modern day webdesign and use .php

I have seen many sites with similar links as my title. I want to know how to implent this sort of system into my own website? My friend says its a "content includer". How exactly do I get this to work?

Thanks.

PuzZah

PuzZah

Status: Offline!
PHP:



<?

if(!$_GET[page]) { // If page is not set
    
$page "main.php"// set $page to main.php
}
else { 
// if page is set
    
    
if($_GET[page] == "index" || $_GET[page] == "index.php") { header("Location: index.php?page="); }

    if(
file_exists($_GET[page])) { // if the file $page exists
        
if (eregi('.php'$_GET[page])) { // if the var $_GET[page] already contains .php
            
include($_GET[page]); // include $_GET[page]
        
}
        else { 
// if the page doesn't have .php already
            
$page $_GET[page].".php"// add .php to $_GET[page]
            
include($page); // And include the new $page var
        
}
    }
    else { 
// if $_GET[page] doesn't exist
        // include("error404.php"); // You might want to use this
        
die("The page $page cannot be found"); // die and give an error
    
}
}

?>

Where main.php is the default page.

Last edited by PuzZah, November 20th, 2004 12:21 AM (Edited 1 times)

Stompy

Stompy

Status: Offline!

This doesn't mean much to me as I haven't done any PHP before? :confused:

ShaunTobias

ShaunTobias

Neversidian
Status: Offline!

http://www.stphp.com/?id=tuts/72484741

___________________

STphp - Modern Web Solutions - CLOSED
ShaunTobias.co.uk - Blog and Portfolio - CLOSED

Look out for LookCreative.co.uk in September.

sinsation

sinsation

23, mother, art slave, code monkey
Status: Offline!

http://www.aesthetic-theory.com/learn.php?query

___________________

And the sig ran away with the spoon.

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!

Good god people, there are like 5 threads on this subject alone on this page. Search please.

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Stompy

Stompy

Status: Offline!
Quote:

Originally posted by lasnaranjas
Good god people, there are like 5 threads on this subject alone on this page. Search please.


Seeing as I didn't know what I was exactly looking for how could I search? Go troll somewhere else.

Thanks to the people who actually helped. Wink

Rad

Rad

thinking of something witty to put here
Status: Offline!
Quote:

Originally posted by Stompy
Seeing as I didn't know what I was exactly looking for how could I search? Go troll somewhere else.

It is the first resource in the sticky.
http://tutorialforums.com/showthread.php?s=&threadid=16851

BigToach

BigToach

Neversidian
Status: Offline!

or you could go by the title of the sticky thread "(READ 1ST, POST 2ND)"

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Neoluke

Neoluke

Status: Offline!

http://www.neoxios.com/?id=tutorials/php&tutorial=5

Read this simple short tutorial.

___________________

VISIT WWW.NEOXIOS.COM NOW!

Quick Jump:

Main Navigation


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


NeverAPI generated this page in 0.0149 seconds.