Posts: 1,832
Location: Somewhere else entirely
|
If you are dealing with template systems, you will need to either a) put ALL the HTML for the whole table into one massive string variable, and assign that to a template variable with something like
PHP Code:
$longstringwithallthehtmlinit = "<table><tr><td>Your table here</td></tr></table>"; $template->assign_vars(array( 'WHOLE_TABLE' => $longstringwithallthehtmlinit ) );
$template->pparse('body');
and then display that by putting {WHOLE_TABLE} into the template file where you want the table to be.
Or b) you can go the slightly more complex but nicer route which is to build up the table row by row into the template:
PHP Code:
//Database query here
while ($row = $db->sql_fetchrow($result)) { if($row['members'] == "No") { $member_link = "None"; } else { $member_link = "<a href=\"members.php?clan=".$row['clan_id']."\">Members</a>"; } $template->assign_block_vars('tablerow', Array( 'CLAN_NAME' => $row['clan_name'], 'CLAN_LEADER' => $row['clan_leader'], 'MEMBERS' => $member_link ) ); }
$template->pparse('body');
and then put this into the template like this:
Code:
<table><tr><th>Clan Name</th><th>Clan Leader</th><th>Members</th></tr>
<!-- BEGIN tablerow -->
<tr><td>{tablerow.CLAN_NAME}</td><td>{tablerow.CLAN_LEADER}</td><td>{tablerow.MEMBERS}</td></tr>
<!-- END tablerow -->
</table>
Please note that I've guessed at a lot of things and you will need to fill in the actual values, filenames and so that exist on your site instead of the ones I've filled in. Also note that all of this is based on my knowledge of the template system that phpBB uses (since it looks very similar), but your CMS may behave slightly differently.
Let us know how you get on with this and if you want further explanation (black variables in templates are tricky).
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)
Last edited by 0beron; 01-09-2006 at 06:17 PM..
|