PDA

View Full Version : vBulletin looping while


MẪ$T?Я
02-23-2010, 06:46 PM
Hello , :rolleyes:

I have a problem in this code .

I'm doing a repetition of the template and extract all the fields in the databases

But does not do it, but the extraction of the first record or last record



$sql = $vbulletin->db->query_read("
SELECT *FROM " . TABLE_PREFIX . "xvip
ORDER BY vipid DESC
");

while($Fetch = $db->fetch_array($sql)){
eval('$VipBlogD[\'vipblogbit\'] = "' . fetch_template('vip_BlogSectionBit') . '";');
}

eval('print_output("' . fetch_template('vip_BlogSection') . '");');

}


BlogSectionBit template


<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<thead>
<tr>
<td colspan="3" class="tcat">blog</td>
</tr>
</thead>
<tbody>
<tr>
<td class="thead" width="100%">blog title</td>
<td class="thead">Last update</td>
<td class="thead">edit</td>
</tr>
</tbody>
<tbody>
$VipBlogD[vipblogbit]
</tbody>
</table>



vip_BlogSectionBit template


<tr>
<td class="alt1" width="100%">$Fetch[blogtitle]</td>
<td class="alt1">$Fetch</td>
<td class="alt1">edit</td>
</tr>



Please let me what a problem .

--------------- Added [DATE]1267036467 at 1267036467 ---------------

Hello ,

Does any of you any help ?

Marco van Herwaarden
02-25-2010, 10:46 AM
Try changing:
eval('$VipBlogD[\'vipblogbit\'] = "' . fetch_template('vip_BlogSectionBit') . '";');

to:
eval('$VipBlogD[\'vipblogbit\'] .= "' . fetch_template('vip_BlogSectionBit') . '";');

MẪ$T?Я
02-25-2010, 02:12 PM
Hello ,

it`s work fine now .

I have another question ,

How do I repeat the work this way, and distributed to the schedules .


This example .
https://vborg.vbsupport.ru/attachment.php?attachmentid=113019&stc=1&d=1267114234

Thank you . :rolleyes:

Marco van Herwaarden
02-25-2010, 02:24 PM
There are several options to do that. Easiest is to remove the new line from the template and only add it after each 2nd item in the loop.