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 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32
  1. #21
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    The one Shane did is secure enough I believe
    Hi, names James. I am a web developer.

  2. #22
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    I'd do this; but you being able to add the content via a different page, but included on the $_GET.

    PHP Code:
    <?php
    $_GET
    ['navigation'];

    switch (
    $_GET['navigation']):
    case 
    "home":
        include 
    "home.php";
        break;
    case 
    "contact":
        include 
    "contact.php";
        break;
    case 
    "freeporn":
        include 
    "freeporn.php";
        break;
    default:
        echo 
    "You did not enter a valid page name into the navigation URL.";
    endswitch;
    ?>

  3. #23
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    The code I posted should be safe seeing as I originally discovered it on ask.com or one of the other professional PHP wiki sites

    I'm presuming your div coding looks something like this currently?

    Code:
    <div id="container">
     <div id="banner"></div>
     <div id="mid">
      <div id="left">
       <div id="box">
        Dummy text
       </div>
       <div id="nav">
    <!-- Nav links -->
        Link
        Link
        Link
        Link
        Link
    <!-- End Nav -->
       </div>
      </div>
      <div id="right">
       <div id="content">
    <!-- Welcome message -->
        Welcome to Site.com , blah blah blah.
    <!-- End message -->
       </div>
      </div>
     </div>
     <div id="footer"></div>
    </div>
    You'd take out the welcome message and put that into the file called main.php which will be shown automatically. You will put the PHP code inside the welcome message comments , where your text previously was.
    You then replace the nav links with the news ones so you should end up with it being:
    Code:
    <div id="container">
     <div id="banner"></div>
     <div id="mid">
      <div id="left">
       <div id="box">
        Dummy text
       </div>
       <div id="nav">
    <!-- Nav links -->
     <a href="index.php?p=about">About</a>
    <a href="index.php?p=news">News</a>
    <a href="index.php?p=staff">Staff</a> 
    <!-- End Nav -->
        </div>
      </div>
      <div id="right">
       <div id="content">
    <!-- Welcome message -->
     <?php
       $page = $_GET['p'];
       if(!isset($page))
       {
          include("main.php");
       }
       elseif(file_exists("". $page . ".php"))
       {
          include("" . $page . ".php");
       }
       else
       {
          print("The page <b>" . $page . ".php</b> does not exist.");
       }
    ?>  
    <!-- End message -->
       </div>
      </div>
     </div>
     <div id="footer"></div>
    </div>
    Quite hard to explain

  4. #24
    Join Date
    Jun 2008
    Location
    Doncaster
    Posts
    885
    Tokens
    0

    Default

    I'll try;

    I have a navigation, latest news, updates and a seperate box on the left and a content box on the right. In the content box I place this code and it will show main.php upon load of the site. I then click the relevant tab on the navigation say, about and it brings up about.php in the content box only but still loads the div's on the left?

  5. #25
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by Arshavin View Post
    I'll try;

    I have a navigation, latest news, updates and a seperate box on the left and a content box on the right. In the content box I place this code and it will show main.php upon load of the site. I then click the relevant tab on the navigation say, about and it brings up about.php in the content box only but still loads the div's on the left?
    Yep, nothing will change other than the div the php is in, that div will load the content for you .

  6. #26
    Join Date
    Jun 2008
    Location
    Doncaster
    Posts
    885
    Tokens
    0

    Default

    That's what I wanted to know

    Thanks Legend.

  7. #27
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    <?php

    $page 
    $_GET"page" ]; // Change this for whatever you want the word after "?" be. (EG, using "page" you will do "?page=blah").

    $args = array( ".""http""www""/""\\" ); // This stops people from getting files in other directories.
    $page str_replace$args""$page );

    if( isset( 
    $page ) && trim$page ) != "" )
    {

        include( 
    $page '.php' );
        
    }
    elseif( !isset( 
    $page ) && trim$page ) == "" )
    {

        include( 
    "main.php" ); // This is the page that will be shown if you don't specify to load another page.
        
    }
    else
    {
        
        include( 
    "404.php" ); // This is the page that will be shown if the page specified to load doesn't exist.

    }

    ?>
    Just another method
    Last edited by Invent; 27-07-2008 at 05:12 PM.

  8. #28
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    The code I posted should be safe seeing as I originally discovered it on ask.com or one of the other professional PHP wiki sites

    I'm presuming your div coding looks something like this currently?

    Code:
    <div id="container">
     <div id="banner"></div>
     <div id="mid">
      <div id="left">
       <div id="box">
        Dummy text
       </div>
       <div id="nav">
    <!-- Nav links -->
        Link
        Link
        Link
        Link
        Link
    <!-- End Nav -->
       </div>
      </div>
      <div id="right">
       <div id="content">
    <!-- Welcome message -->
        Welcome to Site.com , blah blah blah.
    <!-- End message -->
       </div>
      </div>
     </div>
     <div id="footer"></div>
    </div>
    You'd take out the welcome message and put that into the file called main.php which will be shown automatically. You will put the PHP code inside the welcome message comments , where your text previously was.
    You then replace the nav links with the news ones so you should end up with it being:
    Code:
    <div id="container">
     <div id="banner"></div>
     <div id="mid">
      <div id="left">
       <div id="box">
        Dummy text
       </div>
       <div id="nav">
    <!-- Nav links -->
     <a href="index.php?p=about">About</a>
    <a href="index.php?p=news">News</a>
    <a href="index.php?p=staff">Staff</a> 
    <!-- End Nav -->
        </div>
      </div>
      <div id="right">
       <div id="content">
    <!-- Welcome message -->
     <?php
       $page = $_GET['p'];
       if(!isset($page))
       {
          include("main.php");
       }
       elseif(file_exists("". $page . ".php"))
       {
          include("" . $page . ".php");
       }
       else
       {
          print("The page <b>" . $page . ".php</b> does not exist.");
       }
    ?>  
    <!-- End message -->
       </div>
      </div>
     </div>
     <div id="footer"></div>
    </div>
    Quite hard to explain
    Switch case things are better than IF statements, as simon taught me in another thread.

  9. #29
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Switch case things are better than IF statements, as simon taught me in another thread.
    Only in certain circumstances

  10. #30
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    PHP Code:
    <?php

    $page 
    $_GET"page" ]; // Change this for whatever you want the word after "?" be. (EG, using "page" you will do "?page=blah").

    $args = array( ".""http""www""/""\\" ); // This stops people from getting files in other directories.
    $page str_replace$args""$page );

    if( isset( 
    $page ) && trim$page ) != "" )
    {

        include( 
    $page '.php' );
        
    {
    elseif( !isset( 
    $page ) && trim$page ) == "" )
    {

        include( 
    "main.php" ); // This is the page that will be shown if you don't specify to load another page.
        
    }
    else
    {
        
        include( 
    "404.php" ); // This is the page that will be shown if the page specified to load doesn't exist.

    }

    ?>
    Just another method
    You're just extra
    Quote Originally Posted by Calon View Post
    Switch case things are better than IF statements, as simon taught me in another thread.
    Nope they're not, it depends on what you're trying to with them. Lets say you have a large site with around 60 pages, it's not like you're going to make a case for each page and keep adding new ones each time when you can simply let the PHP automatically find the page for you. But if you were to do something simple like having a GD library image form with like 3 or 4 options then switches would do the job better.

Page 3 of 4 FirstFirst 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
  •