PDA

View Full Version : Template Fetch in Foreach Loop -- vB4 (From vB3 Base)


Masked Crusader
12-22-2010, 05:22 PM
Hey all.

I am porting one of my custom created products over to vB4 and am having a problem with one specific area.

Here is what my code looked like in vB3.8:

foreach ($user_ratings as $rating){
$result = $db->query("SELECT username FROM user WHERE userid='{$rating['user_start']}'");
$username = mysql_fetch_assoc($result);
$username = $username['username'];
$date = substr($rating['rating_date'], 0, strpos($rating['rating_date'], " "));

eval('$processedstuff .= "' . fetch_template('total_ratings_loop') . '";');
}

Now, of course, that eval was grabbing the template "foreach" rating that was available. My question is, how can I do this same thing in vB4. I want it to fetch this particular template each time through the "foreach" loop.

Thanks!

Lynne
12-22-2010, 07:29 PM
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)