Jump to content

Why Does Include() Change Layout?


Rollins

Recommended Posts

in a attempt to go without iframes i started using "include()" in my tables.....

<?phpecho '<table width="1000" border="1" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">';echo '<tr><td width="200" valign="top"> location1 logo+link </td><td width="600"> location2 banner </td><td width="200"> location3 </td></tr>';  $location4= 'login/na log in gegevens/ links naar forum en andere paginas';  $location5= include("forumindex.php");  $location6= include("last5.php");  echo '<tr>';  echo '<td width="200" valign="top">'.$location4.'</td>';  echo '<td width="600" valign="top">'.$location5.'</td>';  echo '<td width="200">'.$location6.'</td>';  echo '</tr>';    echo '<tr><td width="200"> location7 </td><td width="600"> location8 </td><td width="200"> location9 </td></tr>';echo '</table>';?>

the scripts used in the includes start with <?php and end with ?>. and use php to extract data from a DB and generates tables wich are closed properly. this is not the problem.... the problem is that the include removes the required parts of the table that i use for the layout. also....there are "mysterious" 1's displayed in the page. i tried require but that creates the same issue. Q1: why does the include() effect the table and displays 1's?Q2: how do i prevent this from happening?Q3: what is the alternative for include() any other tip for not using frames is welcome!

Link to comment
Share on other sites

It's kind of hard to know without seeing all the markup generated, and your styles, but the issue would most likely be that include would return a value of true or false on success, which is why you might seeing the one's. I would suggest just doing the includes "inline"

 echo '<td width="200" valign="top">'. include("forumindex.php") .'</td>';

Link to comment
Share on other sites

The problem is that when you echo the value of include() it returns 1 meaning that the include was successful. You should not echo it.

echo '<td width="200" valign="top">';include 'forumindex.php';echo '</td>';

Link to comment
Share on other sites

i tried the "inline" solution but that did not do the trick.....sorry. after i broke up the lines and did not echo the include() the table was restored!! this novice thanks you for your helpfull replies.......:)

Link to comment
Share on other sites

i tried the "inline" solution but that did not do the trick.....sorry. after i broke up the lines and did not echo the include() the table was restored!! this novice thanks you for your helpfull replies....... :)
oh right, i realized i still had it within an statement that had an echo. That, as you have found out, is the problem.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...