Abominus |
12-29-2008 11:40 AM |
We want to display the award icons in several lines, i.e., add a line break after every 10th icon. Would the following change in the product-yet_another_award_system.xml do the trick?
First we add a new template awards_bit2:
PHP Code:
- <template name="awards_bit2" templatetype="template" date="1174777642" username="Cypher" version=""> - <![CDATA[ <a href="member.php?$session[sessionurl]u=$award[userid]&tab=myawards#aw_issue$award[issue_id]"><img src="$award[award_icon_url]" alt="$award[award_name]" border="0" /></a><br>; ]]> </template>
It's just a copy of the original awards_bit with the   replaced by < br>.
Then we modify the loop inserting the awards as follows. Original version:
PHP Code:
$aw_i = 0;
while ($award = $db->fetch_array($alluserawards)) { $aw_i++; if ($aw_i <= $vbulletin->options['aw_display_limit']) { eval('$post[userawards] .= "' . fetch_template('awards_bit') . '";'); } }
is replaced by
PHP Code:
$aw_i = 0; $aw_cnt = 0;
while ($award = $db->fetch_array($alluserawards)) { $aw_i++; $aw_cnt++; if ($aw_i <= $vbulletin->options['aw_display_limit']) { if $aw_cnt<10 { eval('$post[userawards] .= "' . fetch_template('awards_bit') . '";'); } else { eval('$post[userawards] .= "' . fetch_template('awards_bit2') . '";'); $aw_cnt = 0; } } }
Or is there an easier way to reach the same result?
|