Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   PHP problem (http://www.programmingforums.org/showthread.php?t=15596)

zanatos Apr 11th, 2008 1:25 PM

PHP problem
 
Hello I am trying to make a dynamic php template. However for some odd reason when i run my php program (with xampp) it loads the homepage fine, but my other pages are not working! when i click the other page it seems like it just loads the default template.php file (home page). I will post the code for the following: template.php, navbar.html (for the links), home.php (home page) and about.php( the second page that does not work)

Here is the code:
Template.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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
        background-image: url(images/BG.gif);
}
-->
</style></head>

<body>

<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td> 
                <?php
                        include("Head.html");
                ?>
    </td>
  </tr>
  <tr>
    <td>
                <?php
                        include("navbar.html");
                ?>
    </td>
  </tr>
  <tr>
    <td>
            <?php
                        include("navwrapper.html");
                ?>
    </td>
  </tr>
  <tr>
    <td>
        <?php
       
                if($_GET["file"]=="abt"){
                        include("about.php");
                }else if($_GET["file"]=="serv"){
                        include("services.php");
                }else{
               
                include("home.php");
                }
        ?>   
        </td>
  </tr>
  <tr>
    <td>
            <?php
                        include("footer.html");
                ?>
    </td>
  </tr>
</table
>
</body>
</html>


Code for the links (navbar.html)

:

<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
            <img src="images/home.gif" width="83" height="82"
        onmouseover="this.src='images/home_roll.gif'"
        onmouseout="this.src='images/home.gif'"
        onmouseup="document.location='Template.php?'"/>
    </td>
        <td>
            <img src="images/about.gif" width="84" height="82"
        onmouseover="this.src='images/about_roll.gif'"
        onmouseout="this.src='images/about.gif'"
        onmouseup="document.location='Template.php?file=about'"/>
    </td>
    <td>
                    <img src="images/services.gif" width="84" height="82"
        onmouseover="this.src='images/services_roll.gif'"
        onmouseout="this.src='images/services.gif'"
        onmouseup="document.location='Template.php?file=services'"/>
    </td>
    <td>
            <img src="images/clients.gif" width="83" height="82"
        onmouseover="this.src='images/clients_roll.gif'"
        onmouseout="this.src='images/clients.gif'"/>
    </td>
    <td> 
            <img src="images/contact.gif" width="84" height="82"
        onmouseover="this.src='images/contact_roll.gif'"
        onmouseout="this.src='images/contact.gif'"/>
    </td>
    <td><img src="images/navwrapper.gif" width="381" height="82"/></td>
  </tr>
</table>
</body>
</html>


Code for home.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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript">

function Intro(){
        window.alert("Welcome to Scale up")
        var na = prompt("What is your name?")
        window.alert("Hello " + na)
        confirm("Please click ok if you which to learn more about Scale up!")
}

</script>

</head>
<body onload="Intro()">

<table width="800" height="494" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/content.gif">
    <table border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td>
                <?php
                                print "Welcome to Scale up!";       
                        ?>
        </td>
      </tr>
    </table></td>
  </tr>
</table>

</body>
</html>


Code for about.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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

</head>

<body>
<table width="800" height="494" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/content.gif"></td>
   
    <table width="800" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>
                        <?php
                                        print "ABOUT PAGE";       
                                ?>
                </td>
              </tr>
    </table>
       
  </tr>
</table>


</body>
</html>


note: the background image loaded in home.php and about.php is where I would want my content to go.

Thank you and I would apreciate any help, as this problem is very frustrating :'( lol keep in mind this is my first time doing php.

zanatos Apr 11th, 2008 3:06 PM

Re: PHP problem
 
ok well I found one of the problems. in the navbar.html i have file="about" it should be file="abt" lol. still having some problems i will take another look, and if i still can't find the problem i will be back!

update: well its working fine now(lol dumb mistakes), the only thing that I don't know how to solve is positioning the txt. when I print some text it doesn't show up at the top but near the bottom. is there any way I can solve this without throwing a div in and using css to absolute position it?

zanatos Apr 11th, 2008 8:56 PM

Re: PHP problem
 
Any ideas on how to position the text? I don't want to absolute postion it, since it will look different on different monitors.

Ooble Apr 12th, 2008 12:09 AM

Re: PHP problem
 
Is there any chance you could put this up on a server? It's hard to visualise as code.


All times are GMT -5. The time now is 1:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC