PDA

View Full Version : PHP Rendering Issues



Medyman
06-30-2007, 02:35 AM
Hey guys...

I have the following PHP code within a larger page (also included below):

Troublesome PHP


<?
if($fail)
{
echo "<div id=error>NO SEARCH RESULTS</div>";
}
else{
if($_GET[s])
echo "<div id=error>SEARCH RESULTS</div>";
if(!sizeof($res))
echo "<div id=error>NO POSTS TO DISPLAY</div>";
foreach($res as $row){
?>


Entire Document

<?
$fail = false;
if(isset($_GET[s]))
include("search.php");
else
include("recent.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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="js/swfobject.js"></script>
<link type="text/css" rel="stylesheet" href="css/Style.css" />
<link rel="shortcut icon" href="favicon.ico" />
<title>THEPAPERBAGWRITER // CHANGING THE WAY INFORMATION FLOWS</title>
</head>
<body bgcolor="#ffffff">

<div id="container">

<div id="mainframe" >
<form id="myform" action="POST">
<input type="text" class="textinput" /> <input class="submit" type="image" src="images/form.png" />
</form>

<div id="musicholder">
<div id="flashmusic">To view the header, please upgrade your Flash plugin.</div>
<script type="text/javascript">
var so = new SWFObject("musicPlayer.swf", "music", "340", "20", "8", "#CCCCCC");
so.addParam("quality", "high");
so.addParam("wmode", "opaque");
so.addParam("salign", "t");
so.addParam("scale", "noscale");
so.write("flashmusic");
</script>

</div>
<div id="musiccredit" style='float:right;'><a href="http://www.caribou.fm/site/">MUSIC BY CARIBOU</a></div>
<div id="menuline">&nbsp;</div>

<div id="flashcontent">To view the header, please upgrade your Flash plugin.</div>
<script type="text/javascript">
var so = new SWFObject("header2.swf", "index", "700", "250", "8", "#ffffff");
so.addParam("quality", "high");
so.addParam("wmode", "opaque");
so.addParam("salign", "t");
so.addParam("scale", "noscale");
so.write("flashcontent");
</script>

<div id="leftframe">
<div id ="news">
<div id="framehead"><img src="images/news.jpg" alt="news" /></div>
<div id="newsart">
<span id="date">06.15.07</span>
<br />SUBMISSIONS FOR ISSUE ONE WILL BE CLOSING SOON, THIS IS YOUR LAST CHANCE TO SUBMIT YOUR POETRY, PROSE AND TEXT FOR CONSIDERATION IN OUR FIRST ISSUE.
<br />
<br /><span id="date">06.05.07</span>
<br />NEW PODCASTS! WE ARE PLEASED TO ANNOUNCE OUR FIRST EVER PODCAST, PAPER + PLASTIC IS NOW AVAILABLE THROUGH OUR SITE, APPLE.COM AND ON EAST VILLAGE RADIO.
<br />
<br /><span id="date">05.25.07</span>
<br />NEW SITE! ENJOY THE NEW SITE COURTESY OF DESIGNS BY VISHAL. IF YOU HAVE ANY QUESTIONS OR COMMENTS, PLEASE EMAIL WEB@THEPAPERBAGWRITER.COM
</div>
</div>
<br />
<div id="video">
<div id="framehead" style='background-image:URL("images/videos.jpg");'><a href="http://www.adbusters.org"><img src="images/kalle.gif" style='float:right;margin-top:2px;' alt="Kalle Head" /></a></div>
<div id="youtube"><embed src="http://www.youtube.com/v/-GhXKILWcG8" type="application/x-shockwave-flash" width="100%" height="210"></embed></div>
</div>
<br />
<div id="personals">
<div id="framehead"><img src="images/personals.jpg" alt="personals" /></div>
<span id="opening">LOOKING FOR A CARTOONIST</span>
<span id="desc">Looking for a cartoonist, somewhere between 4í8 and 8í9, preferably male or female (although I donít discriminate) must be out going, fun loving romantic who shares my adoration and enthusiasm for Fellini and Mozart and candle lit dinners. Must have at least six fingers and some experience in the visual arts. <br /><br />*If you meet at least 32% of these requirements and are interested in joining our team, drop us a line at 516.474.3947 or email us at team@thepaperbagwriter.org</span>
</div>


</div>

<div id="rightframe">
<div id ="rp">
<div id="framehead" style='width:98%'><img src="images/recentposts.jpg" alt="Recent Posts" /></div>
<?
if($fail)
{
echo "<div id=error>NO SEARCH RESULTS</div>";
}
else{
if($_GET[s])
echo "<div id=error>SEARCH RESULTS</div>";
if(!sizeof($res))
echo "<div id=error>NO POSTS TO DISPLAY</div>";

foreach($res as $row){
?>

<div id="postborder">
<div id="post">
<div id="title">
<? echo "<a href=$blogurl/".$row[blogid]."/?p=".$row[pid].">".$row[post_title]."</a>"; ?>
</div>

<div id="content">
<? if($_GET[s]) echo parsecontent($row[post_content]); else echo $row[post_content]; ?><span id="more"><a href="<? echo "$blogurl/".$row[blogid]."/?p=".$row[pid]; ?>"> [...] MORE</a></span>
</div>
</div>
</div>
<?
}
}
?>
</div>
</div>
</div>

<div id="sideframe">
<a href="brownpaper.php"><img src="images/firstissue.jpg" alt="First Issue" /></a>
<div id="framehead"><img src="images/bptitle.jpg" alt="Brown Paper" /></div>
<br />

<a href="paperandplastic.php"><img src="images/pp.jpg" alt="Paper and Plastic" /></a>
<br />

<a href="donations.php"><img src="images/donate2.jpg" alt="Donate" /></a>
<br />

<a href="subscribe.php"><img src="images/subscribe2.jpg" alt="Subscribe" /></a>
<br />

<a href="shop.php"><img src="images/shop2.jpg" alt="Shop" /></a>
<br />

<a href="http://www.myspace.com/mybrownpaperbag"><img src="images/myspace2.jpg" alt="MySpace" /></a>

</div>
</div>

</body>
</html>



The "troublesome php" listed above seems to be setting of my page's alignment in FF. Screenshots of how it renders in FF and IE are here: http://www.dynamicdrive.com/forums/showthread.php?t=22110.

Does anyone know what could be causing this?

When I take out that bit of php, it aligns perfectly (but then, it produces errors within the php so taking it out is not an option).

djr33
06-30-2007, 02:38 AM
What's the CSS for the "error" div? I'm almost positive that's the issue, and completely unrelated to the PHP code.

Medyman
06-30-2007, 03:23 AM
This is no css for the error div.

Should I add something?

djr33
06-30-2007, 03:26 AM
Hm... I assumed that there was a width value applied to the divs that was throwing something off. If not, then I'm not sure.
Can you link us to the page?

Remember, the PHP itself has very little to do with what is actually displayed... just the source code of the page itself. Once you find the problematic part of the outputted source, all you need is to find the bit of php that outputs it.

Medyman
06-30-2007, 03:36 AM
The page is here (http://www.thepaperbagwriter.org)

The weird part is that the error happens even when I test locally (i.e. the php is not running). So, I assumed it had to do with how the php is written.

Medyman
07-01-2007, 06:34 PM
Any ideas, anyone?

thetestingsite
07-01-2007, 06:46 PM
Simple answer: It's not a PHP issue, but it is a CSS issue.

When I view the images in the thread you linked to and look at the page in both IE7 and FF, they both look the same (no problems whatsoever); however, I did notice there are a few CSS errors (when viewed in FF). Other than that, I have no clue what the problem is because it seems to be fixed in those browsers.

Hope this helps.

Medyman
07-01-2007, 10:47 PM
Thanks for the response!

My issue is that there is no css over the "error" div. So, I'm failing to understand why this is causing an error.