karimali831 Posted April 7, 2010 Share Posted April 7, 2010 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. Quote Link to comment Share on other sites More sharing options...
br0ken Posted April 7, 2010 Share Posted April 7, 2010 I'm not sure what you're trying to do but when you do $variable = ''; you're assigning an empty value to $variable and aren't actually outputting anything. Quote Link to comment Share on other sites More sharing options...
karimali831 Posted April 7, 2010 Author Share Posted April 7, 2010 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? Quote Link to comment Share on other sites More sharing options...
karimali831 Posted April 7, 2010 Author Share Posted April 7, 2010 no one knows? Quote Link to comment Share on other sites More sharing options...
karimali831 Posted April 8, 2010 Author Share Posted April 8, 2010 Quote Link to comment Share on other sites More sharing options...
five Posted April 8, 2010 Share Posted April 8, 2010 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"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.