Quote:
Originally Posted by cellarius
You're overwriting results with every while loop. Get the template stuff out of the while loop, and make sure your variable does not get overwritten (save the results into an array, for example.
|
Thanks the above does seem to work, but as you said i suspected i had the coding done wrong.
Sorry i am a newbie with vBulletin coding as you can see and am trying to convert my old site so it works pretty much the same.
I have edited my my code to look like this, but nothing appears:
Code:
$image = $vbulletin->db->query("SELECT * FROM ".TABLE_PREFIX."dbtech_gallery_images WHERE roll_id = '$threadid'");
while ($row = $vbulletin->db->fetch_array($image))
{
$imageresults = array();
$imageresults['imageid'] = $row['imageid'];
$imageresults['title'] = $row['title'];
$imageresults['filename'] = $row['filename'];
}
$templater = vB_Template::create('test');
$templater->register('displayres', $imageresults);
$templatevalues['my_insertvar'] .= $templater->render();
vB_Template::preRegister('SHOWTHREAD', array('$templatevalues'));
AND IN test TEMPLATE:
Code:
{vb:raw displayres.id}
{vb:raw displayres.title}
{vb:raw displayres.filename}