Jump to content

Strange problem


karimali831

Recommended Posts

Hi folks,

 

I'm having a problem with this, hope someone can help.

When I use echo ''; I receive all outputs correctly but when I use $variable = '';, I only receive one row?

      $asmember = '
      <tr bgcolor="'.$bgcolor.'"><td>
			<table width="100%" cellpadding="1" cellspacing="2">
                            <td width="30%"><img src="images/icons/go.png"> <b>'.$teamname2.'</b></td>
                            <td width="70%"><img src="images/icons/manage.gif" width="10" height="10"> <a href="?site=clans&action=show&clanID='.$clanID2.'">View/Manage Team</a></td></tr>
                           </table></td></tr>';

 

and my HTML file

 

			<tr bgcolor="$bg1">
			<td bgcolor="$pagebg">$asmember</td>
		</tr>

 

By using echo, it will show the results but will position it from the php file so I need to use variable.

Link to comment
https://forums.phpfreaks.com/topic/197923-strange-problem/
Share on other sites

xD I know that. Ok, I'll show you what I mean.

$variable = $asleader

 

  <?php    $asleader = '
      <tr bgcolor="'.$bgcolor.'"><td>
			<table width="100%" cellpadding="1" cellspacing="2">
                            <td width="30%"><img src="images/icons/go.png"> <b>'.$teamname2.'</b></td>
                            <td width="70%"><img src="images/icons/manage.gif" width="10" height="10"> <a href="?site=clans&action=show&clanID='.$clanID2.'">View/Manage Team</a></td></tr>
                           </table></td></tr>';

...
	eval("\$profile = \"".gettemplate("profile")."\";");
	echo $profile;
?>

 

the profile.html template:

 

         <tr bgcolor="$bg1">
            <td bgcolor="$pagebg">$asmember</td>
         </tr>

 

Output: 1 result -- row from table.

 

If I used this:

 

echo  '
      <tr bgcolor="'.$bgcolor.'"><td>
			<table width="100%" cellpadding="1" cellspacing="2">
                            <td width="30%"><img src="images/icons/go.png"> <b>'.$teamname2.'</b></td>
                            <td width="70%"><img src="images/icons/manage.gif" width="10" height="10"> <a href="?site=clans&action=show&clanID='.$clanID2.'">View/Manage Team</a></td></tr>
                           </table></td></tr>';

 

It will display all rows but at top of the page so that's why I am using this variable $asleader and putting it in my html table to position it, but it only shows one row/result?

Link to comment
https://forums.phpfreaks.com/topic/197923-strange-problem/#findComment-1038595
Share on other sites

first off positioning your php code inside html is not that hard and it is not necessary to use a variable. you can close tags. like if i do

 

some html here<br />
<?php
// some php code here
?>
now a html table follows<br />
<table>
<tr>
<td width="250"> </td>
<td>now i want some php code to be executed to output something in this cell so..
<?php
$variable = '<b>something</b>';
echo $variable;
echo '123456789';
?>
and still in the same cell i got some more html like <u>this</u>
</td>
</tr>
</table>

 

also why not write valid html? i think all tables need to have a <tr> tag even if they have just one.

 

when you say all rows? i see only one row, which contains a cell, which contains a table with two cells.

 

you can also

 

echo gettemplate("profile");

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/197923-strange-problem/#findComment-1038823
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.