View Full Version : Not Reading PHP


mandarinspyce
02-06-2007, 02:02 AM
I'm trying to make a div with overflow, but for some reason it's not working. I know this is possible, because I've done it before. The main.php file is not being recognized/read for some odd reason. I can't quite figure out why :confused:

Any help is appreciated. Thanks!

index.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Untitled-1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">
<center>
<div id="Table_01">
<div id="id01">
<img src="images/01.png" width="796" height="108" alt="">
</div>
<div id="id02">
<img src="images/02.png" width="269" height="231" alt="">
</div>
<div id="id03">
<img src="images/03.png" width="198" height="231" alt="">
</div>
<div id="id04" name="main" style="background: url('images/04.png'); background-repeat: no-repeat; background-color: #eaeaea; overflow: auto;">
<?php
$page = $_GET['page'];
if ($page) {
$page = $page . '.php';
include($page);
}
else {
include('content.php');
}
?>
</div>
<div id="id05">
<img src="images/05.png" width="50" height="231" alt="">
</div>
<div id="id06">
<img src="images/06.png" width="796" height="115" alt="">
</div>
</div>
</center>
</body>
</html>

style.css
body {
background-image: url('images/bg3.jpg');
background-repeat: repeat-x;
font-family: verdana;
color: #000000;
font-weight:normal;
font-size: 7pt;
line-height: 9pt;
text-align:justify;
}

#Table_01 {
position:absolute;
left:250px;
top:49px;
width:796px;
height:454px;
}

#id01 {
position:absolute;
left:0px;
top:0px;
width:796px;
height:108px;
}

#id02 {
position:absolute;
left:0px;
top:108px;
width:269px;
height:231px;
}

#id03 {
position:absolute;
left:269px;
top:108px;
width:198px;
height:231px;
}

#id04 {
position:absolute;
left:467px;
top:108px;
width:279px;
height:231px;
background: url('images/04.png');
background-repeat: no-repeat;
background-color: #eaeaea;
overflow: auto;
}

#id05 {
position:absolute;
left:746px;
top:108px;
width:50px;
height:231px;
}

#id06 {
position:absolute;
left:0px;
top:339px;
width:796px;
height:115px;
}

main.php
hello world!
<p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
scrolly scroll.

CuriousLittleBird
02-06-2007, 02:27 AM
Uh... :scared: *feels sorely inadequate in PHP learning* Where exactly is main.php supposed to display in the layout? I ask because I don't see its URL anywhere in the code. I see a div named "main," so I assume that's where it's supposed to be, but I'm not sure.

I don't see anything wrong with your CSS or PHP coding (or what little of PHP and its interactions with MySQL I understand). Do you need (or are you planning to use) PHP includes with the main.php file? I don't know if that would make the file display incorrectly or not, but just a thought.

mandarinspyce
02-06-2007, 02:42 AM
Well, I just uploaded it to my server, and it's working just fine there (http://www.four-nineteen.org/private/02/). But on my computer here, (I have both Apache and PHP installed and they do work) it's not showing up.

My page is to show up right where this code is:


<?php
$page = $_GET['page'];
if ($page) {
$page = $page . '.php';
include($page);
}
else {
include('main.php');
}
?>


I made a mistake in posting the original code. It's edited now:
index.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Untitled-1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">
<center>
<div id="Table_01">
<div id="id01">
<img src="images/01.png" width="796" height="108" alt="">
</div>
<div id="id02">
<img src="images/02.png" width="269" height="231" alt="">
</div>
<div id="id03">
<img src="images/03.png" width="198" height="231" alt="">
</div>
<div id="id04" name="main" style="background: url('images/04.png'); background-repeat: no-repeat; background-color: #eaeaea; overflow: auto;">
<?php
$page = $_GET['page'];
if ($page) {
$page = $page . '.php';
include($page);
}
else {
include('main.php');
}
?>
</div>
<div id="id05">
<img src="images/05.png" width="50" height="231" alt="">
</div>
<div id="id06">
<img src="images/06.png" width="796" height="115" alt="">
</div>
</div>
</center>
</body>
</html>

I dunno. Maybe it's just something with my Apache/PHP on my computer... if it's working on my site's server.

decepti0n
02-07-2007, 07:03 AM
There doesn't seem to be anything wrong with that.

Try using require('main.php'), if it isn't working it'll come up with a fatal error which would be more help.

bejayel
02-07-2007, 07:35 PM
require() - If the file cant be loaded or found, the whole script wont run
include() - Include the file, if it cant be found show an error, but dont stop processing
include_once() - include the file ONLY ONCE. Useful if you are including over multiple tiers.

They are al going to try and include the file. In my honest opinion, the error from the include will be more descriptive than the one from require. It might not be loading because of permissions to the file.

Kallan
02-13-2007, 12:48 PM
What host are you using for your website?

davis23
02-18-2007, 10:19 PM
im using myspace? is that my host? but i want to highlight all my text on my profile, can i doo that with out typing the URL for each section