Tong-Pak-Fu
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Tong-Pak-Fu

A place to relax and discuss.
 
HomePortalSearchLatest imagesRegisterLog in

 

 PHP: Using PHP to Draw Pages

Go down 
AuthorMessage
BlUeAnGeL
New Otaku
New Otaku
BlUeAnGeL


Number of posts : 85
Registration date : 2007-04-21

PHP: Using PHP to Draw Pages Empty
PostSubject: PHP: Using PHP to Draw Pages   PHP: Using PHP to Draw Pages Icon_minitimeSat May 05, 2007 6:19 pm

Okay, so you have your website all up.. and you dont want a new html file for every page on your site.. Well there is a simple way to solve this.. heres how..

Step 1: Create a folder called 'pages' in the same folder as your website..

Step 2: Open up your index for your site (make sure the file ends in .php)

Step 3: In your index, Go to the part where your content would be displayed. and put in this code:

Code:
<?
$page = $_GET['page'];
if ($page == '') {
    include 'pages/home.php';
} else {
    if (file_exists('pages/' . $page . '.php')) {
        include 'pages/' . $page . '.php';
    } else {
        include 'pages/home.php';
    }
}
?>

Step 4: In your pages folder make a file called home.php and fill that with your homepage content ex, 'Welcome to the site!'

Step 5. For everypage you want you just make a file in the pages folder called whatever.php

Now once you have done that.. to draw those pages. all you have to do is goto.. http://your website here/index.php?page=the-page-name


Well i hope you guys can understand my weird tutorial >.>
Back to top Go down
 
PHP: Using PHP to Draw Pages
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Tong-Pak-Fu :: Graphics And Web Discussion :: Photoshop/Webdesign :: Tutorial :: Web Design Tutorials-
Jump to: