Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Oct 2006
    Location
    London
    Posts
    342
    Tokens
    0

    Default index.php?page=10

    Hi

    to make my sites i use front page therefore i cant code php (well i can manually.) however i would like to use this fucntion of php on my site:

    mysite.com/index.php?page=1

    you know, so the index template is the same and content is from the ?page=1

    as i dont have dreamweaver i have to do this manually and im not sure how. i might be able to guess but the problem is i cant preview it as i work!

    is there a documentation/tutorial i can use for this???

    thank you + rep

  2. #2
    Join Date
    Sep 2006
    Location
    Oxford, United Kingdom
    Posts
    574
    Tokens
    0

    Default

    http://madkid.org/?x=php/phpnav

    That gives you a simple version of what your looking for, however...all pages must be the same file type for that code.

    (all files must be .html, .php and you must configure that using the tutorial on there)

    also - Incase you didnt know - the file your going to put this code in needs to have a .php extention.

    - CHTom

  3. #3
    Join Date
    Oct 2006
    Location
    London
    Posts
    342
    Tokens
    0

    Default

    Quote Originally Posted by CHTom View Post
    http://madkid.org/?x=php/phpnav

    That gives you a simple version of what your looking for, however...all pages must be the same file type for that code.

    (all files must be .html, .php and you must configure that using the tutorial on there)

    also - Incase you didnt know - the file your going to put this code in needs to have a .php extention.

    - CHTom
    yep i know about the .php extention, i had dreamweaver on my old cpu and not this one. + rep

  4. #4
    Join Date
    Nov 2006
    Location
    Doncaster, UK
    Posts
    1,700
    Tokens
    0

    Latest Awards:

    Default

    Why do you need Dreamweaver to code PHP?
    unitedstates,canada,mexico,panama,haiti,jamaica,pe ru,republicdominian,cuba,caribbean,greenland and el salvadour too.
    puertorica,colombia,venezuela,honduras,guyana and still, guatamala,bolivia then argentina and ecuador,chile,brazil.
    costarica,belize,nicaragua,bermuda,bahamas,tobago, sanjuan,paraguary,uruguay,suriname,frenchguiana,ba rbados and guan.
    norway and sweden and iceland and finland and germany now one piece, switzerland,austrira,czechoslovakia,italy,turkey and greece.



  5. #5
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    Wrote this for you... Very simple

    page.php?page=x

    PHP Code:
    <?php
    if($_GET[page] == "1"){
    ?>
    Hello this is page 1 la la la la....
    <?php
    }
    if(
    $_GET[page] == "2"){
    ?>
    This is page 2 do do dooo...
    <?php
    }
    if(
    $_GET[page] == "3"){
    ?>
    This is page 3 mmm mmm mmm....
    <?php
    }
    else{
    ?>
    This is if the page is anything else
    <?php
    }
    ?>

  6. #6
    Join Date
    Nov 2006
    Posts
    163
    Tokens
    0

    Default

    Name each of your pages 1.php and 2.php etc, and do:

    <?php
    $val = $_GET['page'];
    $val .= ".php";
    $dirty = array("..");
    $clean = array("");
    $val = str_replace($dirty, $clean, $val);

    if (isset($_GET['page'])) {
    if (file_exists($val)) {
    include "$val";
    }
    else {
    include "404.php";
    }
    }
    else {
    include "main.php";
    }
    ?>

  7. #7
    Join Date
    Sep 2006
    Location
    Oxford, United Kingdom
    Posts
    574
    Tokens
    0

    Default

    Erm, I already gave the guy a tutorial on it, lol.

    Wasnt really much need for the other two codes....but im sure he/she appreciates it.

  8. #8
    Join Date
    Nov 2006
    Location
    Leeds, Yorkshire
    Posts
    992
    Tokens
    0

    Default

    PHP Code:
    switch ($_GET['page']) {
    case 
    "1":
       include(
    '1.html');
       break;
    case 
    "2":
       include(
    '2.html');
       break;
    case 
    "3":
       include(
    '3.php');
       break;

    That would work, you just have to add the pages manually.
    Last edited by omgDAN!; 03-12-2006 at 01:00 PM.


  9. #9
    Join Date
    Aug 2005
    Posts
    856
    Tokens
    0

    Default

    PHP Code:
    <?
    if($_GET[page]){
    $page $_GET[page];
    }else{
    $page home//or whatever your default page to show is.
    }
    ?>
    then where you want the page displayed put

    PHP Code:
    <?
    include("$page.php");
    ?>
    All works fine
    Last edited by xRoyal15; 03-12-2006 at 01:11 PM.

  10. #10
    Join Date
    Nov 2006
    Posts
    163
    Tokens
    0

    Default

    Use functions:

    PHP Code:
    <?
    function page($url)
    {
    include <<<EOF
    {
    $url}.php
    EOF;
    }
    ?>
    Then:

    PHP Code:
    <?
    include('func.php');
    $url $_GET['page'];
    page($url);
    ?>

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •