newbtophp Posted July 28, 2010 Share Posted July 28, 2010 Im using the XTemplate templating system (http://www.phpxtemplate.org) All works fine, however, Im having issues when it comes to while loops: I have the following within header.php: <?php include_once('./xtemplate.class.php'); $xtpl = new XTemplate('header.xtpl'); $result = mysql_query("SELECT username FROM site_table"); while($row = mysql_fetch_assoc($result)) { echo $row['username']; } $xtpl->parse('header'); $xtpl->out('header'); ?> And the following with header.xtp: <td width="239" valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="5"> <tr> <td bgcolor="#8b0000"> <div align="center">User List</div> </td> </tr> <td valign="top" bgcolor="#660000"> <div align="center"> <table width="100%" border="0" cellpadding="0" cellspacing="2"> <tr> <td> <div align="left"> <tr> <td width="93%" bgcolor="#500F0C"> <div align="left"> {USERNAME} </div> </td> </tr> </div> </td> </tr> </table> </div></td> </tr> </table> How would I go by doing the above? Quote Link to comment https://forums.phpfreaks.com/topic/209057-xtemplate-how-to-integrate-while-loop/ 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.