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 4 1234 LastLast
Results 1 to 10 of 32
  1. #1
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default [PHP Includes - Help] Linking.

    Hey, I want to use PHP includes for the content on my site, but how would I go about this? I want it so when you press the link saying "Home" for example, I would click it and then in the content box it'd change to the homepage text.

    If you didn't undertstand that, I want it so it's like an iframe, where you click the link and it gets the iframes info and puts it in the content section, jut with php includes.

    It's sorta hard to explain

    Thanks.

  2. #2
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Hmm.. like index.php?page=balkbjalkj?

  3. #3
    JoeComins Guest

    Default

    Put this code where you want your page to appear:

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

    if (isset($_GET['id'])) {
    if (file_exists($val)) {
    include "$val";
    }
    else {
    include "404.php";
    }
    }
    else {
    include "home.php";
    }

    // Include this script in your content area
    // Run ?id=pagename (without .php) to view a page
    ?>
    That will show either your home.php or error page.
    If not, make a home.php

    Then your link to show any other pages would be:

    http://www.DOMAIN.com/index.php?id=PAGE

    Dont put teh .PHP on the end

  4. #4
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    I dunno if thats what I meant

    I wanted it so that instead of clicking "news.php" on my site, then it going to a whole new page, I wanted it so when I clicked "news.php" it would open where the old content was. Like an iframe. But with php includes.

  5. #5
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:


  6. #6
    JoeComins Guest

    Default

    Yes - That is right - Use it - I use that on every site.

    if you put that code where you wnt your page to open. . . .

  7. #7
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Zengo View Post
    I dunno if thats what I meant

    I wanted it so that instead of clicking "news.php" on my site, then it going to a whole new page, I wanted it so when I clicked "news.php" it would open where the old content was. Like an iframe. But with php includes.
    I think you're looking for a JavaScript navigation method.
    kinda quit.

  8. #8
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by JoeComins View Post
    Yes - That is right - Use it - I use that on every site.

    if you put that code where you wnt your page to open. . . .
    Okay thanks Joe.

    And josh, it's ok now

  9. #9
    JoeComins Guest

    Default

    Whats the site, and ill do it for you

    Joshua - What the hell mate? Just no

  10. #10
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by JoeComins View Post
    Whats the site, and ill do it for you

    Joshua - What the hell mate? Just no
    Site is team-x-labs.net, PM me.

    PM me Or I may have done it by the time your online (doing now).

    EDIT: I don't think it is what I mean. Cos, as far as I can tell (I may be wrong), but when you click the link in the nav, it opens the page, loads all the template again, then gets the file you want and puts it in the box where the code goes.

    I want it so it loads the template once, then the rest is like iframes. So you click the link and the only thing it does is load the content. Isn't there a way so it says <? include ("file.php") id="name"?> then on the link you make it so it loads over name?
    Last edited by Hitman; 11-09-2006 at 06:07 PM.

Page 1 of 4 1234 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
  •