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 3 123 LastLast
Results 1 to 10 of 26
  1. #1
    Join Date
    Oct 2006
    Posts
    12,405
    Tokens
    0

    Latest Awards:

    Angry What's wrong with this?

    Ok I've tried a few different things and spent the last couple of hours looking at tutorials on Google and on the forum but they all say the same thing which doesn't resolve the problem.

    Basically my php includes won't work. I am now able to see my homepage's content but any link I click just stays with the homepage's content instead of its respective content.


    Here is my navigation menu:

    Code:
    &raquo; <a href="index.php">Home</a> <br />
         &raquo; <a href="index.php?p=news">News</a> <br />
         &raquo; <a href="index.php?p=values">Classic Rare Values</a> <br />
         &raquo; <a href="index.php?p=guides">Guides</a> <br />
         &raquo; <a href="index.php?p=knowledge">Knowledge</a> <br />
         &raquo; <a href="index.php?p=links">Links</a> <br />
    And here is my include which is in the content section of my index file:

    Code:
    <?php
    $_GET['page'];  
    if($page == "home")
    {
    include('home.php');
    }
    elseif($page == "news")
    {
    include('news.php');
    }
    elseif($page == "values")
    {
    include('values.php');
    }
    elseif($page == "guides")
    {
    include('guides.php');
    }
    elseif($page == "knowledge")
    {
    include('knowledge.php');
    }
    elseif($page == "links")
    {
    include('links.php');
    }
    else
    {
    include('home.php');
    }
    
    ?>
    If anyone can spot the error, it'd be wonderful .

  2. #2
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    If you read the other page, you would have seen it was solved already.

    PHP Code:
    change $_GET['page'to $page $_GET['page']; 


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  3. #3
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Why don't you just do something similar to this:

    PHP Code:
    <?php

    $page 
    $_GET["page"];
    $page "{$page}.php";

    if(!
    file_exists($page)) {
        include 
    "404.php";
    } else {
        include 
    $page;
    }

    ?>
    Last edited by Dentafrice; 20-07-2009 at 02:05 AM.

  4. #4
    Join Date
    Oct 2006
    Posts
    12,405
    Tokens
    0

    Latest Awards:

    Default

    Doesn't work.

    And I did read everything in the other thread, I just don't get where people mean for stuff to go sometimes.

    Edit @Dentafrice: I don't understand how to apply that...
    Last edited by Black_Apalachi; 20-07-2009 at 02:08 AM.

  5. #5
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Post your whole page code..

  6. #6
    Join Date
    Oct 2006
    Posts
    12,405
    Tokens
    0

    Latest Awards:

    Default

    lol OK .


  7. #7

    Default

    It's because you're also accessing $_GET['page'] and not $_GET['p'] (as you're using ?p=name as opposed to ?page=name) so either modify the links or modify the key and it should work.

  8. #8
    Join Date
    Oct 2006
    Posts
    12,405
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Iszak View Post
    It's because you're also accessing $_GET['page'] and not $_GET['p'] (as you're using ?p=name as opposed to ?page=name) so either modify the links or modify the key and it should work.
    I U +rep :8.

  9. #9
    Join Date
    Apr 2009
    Location
    Illinois, USA
    Posts
    130
    Tokens
    359

    Default

    Quote Originally Posted by Robald View Post
    Doesn't work.

    And I did read everything in the other thread, I just don't get where people mean for stuff to go sometimes.

    Edit @Dentafrice: I don't understand how to apply that...
    It works the same way as the code you're using.. Besides the fact that it's much cleaner, and easier to use.


    My last reputation was from ThisNameWillDo!.

  10. #10
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Just put my code, where your PHP code is.

Page 1 of 3 123 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
  •