Jump to content

php formatting problem


Monkling

Recommended Posts

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:
[code]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>";[/code]

The table attempt:
[code]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>";[/code]

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?
Link to comment
https://forums.phpfreaks.com/topic/18303-php-formatting-problem/
Share on other sites

I mean all that shows up is the file [i]blogarchive.php[/i]. 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 [i]blogarchive.php[/i] file. The [i]index.php[/i] file works perfectly fine on it's own. I've tried putting different php files into the right side & nothing shows up.
Link to comment
https://forums.phpfreaks.com/topic/18303-php-formatting-problem/#findComment-78858
Share on other sites

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

I've been experimenting with everything I can think of. It seems if I do something simple like:
[code]<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"; ?>
[/code]
It works as expected.

But when I substitute that first php code (the one between the div tags) with an [i]include[/i] rather than an [i]echo [/i]statement, it ignores anything that comes after it.
Link to comment
https://forums.phpfreaks.com/topic/18303-php-formatting-problem/#findComment-81444
Share on other sites

[quote author=AndyB link=topic=105189.msg423176#msg423176 date=1156744138]
something in your include is terminating output from the script.
[/quote]
AH!! A lightbulb just went off in my head. I used [i]exit [/i]in that script. Must be that. Now if I could only get it to work without using [i]exit[/i]. Back to the drawing board...

Thank you!
Link to comment
https://forums.phpfreaks.com/topic/18303-php-formatting-problem/#findComment-81668
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.