"For" loop within template

HappyWorld

Well-known member
How to create "for" loop within template? I only see "foreach" loop example.

I have an integer variable called $a which has a numeric value.
I want to do something on template like
PHP:
<?php for ($i = 1; $i < $a; $i++) : ?>
<b>Hello World</b>
<?php endfor; ?>
 
For example i have this code on my template
PHP:
{xen:number $user.reputation_count}
First example : if $user.reputation_count is 5, i want to print 5 asterisks.
Second example : if $user.reputation_count is 10, i want to print 10 asterisks.

Is there something like this?
PHP:
<xen:for "$user.reputation_count">
    <span style="color:#F00">*</span>
</xen:for>
 
This would have the same effect:
Code:
<xen:if is="{$user.reputation_count}">
    <span style="color: #F00">{xen:string repeat, '*', $user.reputation_count}</span>
</xen:if>
 
What are the limits for this reputation count? You wouldn't want to print 100 asterisks I assume. Is it more like a star rating system with 5 stars maximum?
 
This would have the same effect:
Code:
<xen:if is="{$user.reputation_count}">
    <span style="color: #F00">{xen:string repeat, '*', $user.reputation_count}</span>
</xen:if>
Thank you, i think this works :)

What are the limits for this reputation count? You wouldn't want to print 100 asterisks I assume. Is it more like a star rating system with 5 stars maximum?
At this moment it is 5 stars max :)
 
Top Bottom