Jump to content


Photo

php formatting problem


  • Please log in to reply
5 replies to this topic

#1 Monkling

Monkling
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 August 2006 - 02:44 PM

I am trying to format a website with 2 columns. I've tried both CSS and using tables and, in both cases, it only shows the left column & not the right column.

The CSS attempt:
echo"<div style=\"float: left; width: 20%; padding: 5px;\">";
include ("blogarchive.php"); 
echo"</div><div style=\"float:right; width: 75%; padding: 5px;\">";    
include ("index.php"); 
echo"</div>";

The table attempt:
echo"<table width=\"100%\" border=\"1\" padding=\"5\">";
echo"<tr><td width=\"20%\">";   
include ("blogarchive.php"); 
echo"</td><td width=\"80%\">";    
include ("index.php"); 
echo"</td></tr></table>";

Both of these php files work fine and contain no CSS styling of their own. I'm probably missing something really simple but I can't figure out why I can't get this to work.  Any suggestions?

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 August 2006 - 04:55 PM

When you say it doesn't show the right column... do you mean that it just comes up as a white page or it messes up the actual layout?  If you include the index.php file by itself, does it actually work?

Info: PHP Manual


#3 Monkling

Monkling
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 August 2006 - 10:22 PM

I mean all that shows up is the file blogarchive.php. With the CSS code, that is on the left & the right side of the page is blank. With the table columns, there is just one column with that same blogarchive.php file. The index.php file works perfectly fine on it's own. I've tried putting different php files into the right side & nothing shows up.

#4 Monkling

Monkling
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 28 August 2006 - 03:22 AM

Does anyone have a clue why I'm having problems using include with CSS?

I've been experimenting with everything I can think of. It seems if I do something simple like:
<div style="float: left; width: 20%; padding: 5px;">
<?php echo "This is the left column.";   ?> 
</div>
    
<?php echo "And this should show up to the right of the other text"; ?>
It works as expected.

But when I substitute that first php code (the one between the div tags) with an include rather than an echo statement, it ignores anything that comes after it.

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 August 2006 - 05:48 AM

Sounds as though the problem lies with what you're including, i.e. something in your include is terminating output from the script.
Legend has it that reading the manual never killed anyone.
My site

#6 Monkling

Monkling
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 28 August 2006 - 03:51 PM

something in your include is terminating output from the script.

AH!! A lightbulb just went off in my head. I used exit in that script. Must be that. Now if I could only get it to work without using exit. Back to the drawing board...

Thank you!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users