Errors :S

Discussion in 'PHP' started by BenSeagrave, Feb 20, 2009.

  1. #1
    Hello, I'm trying to do dynamic pages and i got told some code, I put it in my website and now im getting errors, The webpage is ment to look like this http://www.homicidalservers.com/ that is what it looked like before i put the code in, but now it looks like this www.boast-host.co.uk/design/new/index.php somethign is seriously wrong, These are my files:


    INDEX.PHP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Untitled Document</title>
    <link href="http://www.boast-host.co.uk/design/new/css/style.css" rel="stylesheet" type="text/css" />
    <?php
    $date = date("d/m/y");
    
    // check for _GET['page'] -> index.php?page= ...
    if (isset($_GET['page']))
    {
        $page = trim($_GET['page']); // delete whitespace
        
        // check what is requested
        switch($page)
        {
            case 'home': // if index.php?page=home then
                include('./pages/home.php');
            break; // jump out of switch()
            
            case 'servers': // if index.php?page=about then ...
                include('./pages/servers.php');
            break;
    		
    		case 'buyadmin':
    			include('./pages/buyadmin.php');
    		break;
    		
    		case 'maps':
    			include('./pages/maps.php');
    		break;
    		
    		case 'pictures':
    			include('./pages/pictures.php');
    		break;
    		
    		case 'donate':
    			include('./pages/donate.php');
    		break;
    		
            
            default: // if something like index.php?page=blabla then
                include('./pages/home.php');
            break;
        }
    }
    
    // if nothing is set, default page
    else include('./pages/home.php');
    
    
    ?>
    </head>
    <body>
    
    <div id="main">
    
    <?php
    include('./includes/header.php');
    
    include('./includes/bar.php');
    
    include('./includes/side.php');
    
    include($page);
    
    include('./includes/footer.php');
    ?>
    
    </div>
    </body>
    </html>
    
    PHP:


    SIDE.PHP:
    <?php 
    echo "<div id=\"side\">
    <h3>Menu</h3>
    &nbsp;&nbsp;- <a href=\"index.php?page=home\">Home</a><br>
    &nbsp;&nbsp;- <a href=\"/forums/\">Forums</a><br>
    &nbsp;&nbsp;- <a href=\"index.php?page=servers\">Servers</a><br>
    &nbsp;&nbsp;- <a href=\"index.php?page=buyadmin\">Buy Admin</a><br>
    &nbsp;&nbsp;- <a href=\"index.php?page=maps\">Maps</a><br>
    &nbsp;&nbsp;- <a href=\"index.php?page=pictures\">Pictures</a><br>
    &nbsp;&nbsp;- <a href=\"index.php?page=donate\">Donate</a><br>
    </div>"
    ?>
    PHP:
    HOME.PHP(all content files are the same for testing so i will only show one)
    <?php
    
    echo"
    <div id=\"content\">
    
    <h2>Home</h2>
    <p>Welcome to our website, Please look around and visit the forums.</p>
    
    </div>"
    
    ?>
    PHP:
    I am not going to include the style.css as it's to long, and i am almost positive that isnt the problem as i didnt change that. can anyone see the problem?

    Thanks
     
    BenSeagrave, Feb 20, 2009 IP
  2. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Agent_Smith, Feb 20, 2009 IP
  3. BenSeagrave

    BenSeagrave Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well what should i put then?
     
    BenSeagrave, Feb 20, 2009 IP
  4. BenSeagrave

    BenSeagrave Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    if no-one can fix this, does anyone no a simpler way to do this?
     
    BenSeagrave, Feb 20, 2009 IP
  5. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #5
    Why do you need to do it using ?page= ?

    Why not just use different pages - it's better for SEO and friendly links.

    If you really need to do it that way, I'll have a think about how best to approach it.
     
    peter_anderson, Feb 21, 2009 IP