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
Share on other sites

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?
Link to comment
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.