Announcement

Collapse
No announcement yet.

index.php?page

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • index.php?page

    Small Tutorial I made for Sasha
    Full Tutorial Can be found here~
    Difficulty : If you can php echo a hello world read on, read on anyways

    About

    Always wanted to convert your site to PHP, but always too intimidated to try? Read on, because I have here the easiest and fastest way to convert your site to PHP.
    Are you already using PHP on your site? Then read on anyway, because the coding used here is optimized, for faster page loading and less hassle for you.

    This script will allow you to put the content for all of your pages into one file, and will display the content needed depending on what url you send your visitors to. The advantages over other PHP conversion scripts you may have seen:

    * All your content will be in one file. No more index.php, about.inc, rules.inc, codes.inc etc...everything will be in index.php. Only one file to edit and upload and it takes up less space on your server.
    * Shorther URLs. It will be index.php?about instead of index.php?z=about.inc
    * Faster loading pages. Since the content is all inside the one page, the PHP script doesn't have to go and get other files off the server, making your pages load faster.
    * Less coding. One line of PHP code will do all this for you.


    PHP Code:
    <?php

    //Copy and paste the HTML that is the same in all your pages (the header and footer) into new files and name them header.inc and footer.inc.
    //They will be included at the complete top and bottom of your pages, so you will only have to edit these 2 files if you want to change your layout.

    include('header.inc');

    if(!
    $_SERVER['QUERY_STRING']) { ?>

    //Paste here the HTML coding you have on your main page. This is what people will see when they go to index.php, without any ?section bit after it.

    <? } elseif ($_SERVER['QUERY_STRING'] == "about") { ?>
    //Paste here your HTML code on the About page (without the header and footer code, obviously).

    <? } elseif ($_SERVER['QUERY_STRING'] == "rules") { ?>
    //Paste here your HTML code on the Rules page (without the header and footer code, obviously).

    <? } elseif ($_SERVER['QUERY_STRING'] == "join") { ?>
    //Paste here your HTML code on the Join page (without the header and footer code, obviously).

    <? } elseif ($_SERVER['QUERY_STRING'] == "codes") { ?>
    //Paste here your HTML code on the Codes page (without the header and footer code, obviously).

    <? } elseif ($_SERVER['QUERY_STRING'] == "members") { ?>
    //Paste here your HTML code on the Members page (without the header and footer code, obviously).

    <? } elseif ($_SERVER['QUERY_STRING'] == "extra") { ?>
    //Paste here your HTML code on the Extra page (without the header and footer code, obviously).

    <? }  
    include(
    'footer.inc'); ?>

    Please note that the page you are inserting this code into, has to have a .php extension, otherwise it won't work!!

    If you use the coding exactly as I have pasted it above in the text box, you will have to change your navigation bar URLs to the following:

    * About: index.php?about
    * Rules: index.php?rules
    * Join: index.php?join
    * Codes: index.php?codes
    * Members: index.php?members
    * Extra: index.php?extra
    Enjoy.

  • #2
    Please post this on vBulletin.org
    We don't support source code things.

    Comment

    Loading...
    Working...
    X