Re: Rotating ads
Posted by
Pedro on
Oct 25, 2013; 4:16pm
URL: https://support.nabble.com/Rotating-ads-tp7587508p7587524.html
Take a look at this code:
<n.comment.>Saving at the variable rand_num a random number between 0 and 100.</n.comment.>
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>
<n.comment.>Printing the random number. You can delete this line later.</n.comment.>
<n.var name='rand_num'/><br/>
<n.comment.>First check: the number has 25% to be between 0 and 25</n.comment.>
<n.comment.>Second check: the number has 40% to be between 25 and 65</n.comment.>
<n.comment.>Third check: the number has 35% to be between 65 and 100</n.comment.>
<n.int. i="[n.var name='rand_num'/]">
<n.if.is_less_than i="25">
<then>25%</then>
<else.if.is_less_than i="65">
<then>40%</then>
<else>35%</else>
</else.if.is_less_than>
</n.if.is_less_than>
</n.int.>
Read, try to understand and see it working at my forum header:
http://pedro.2313024.n4.nabble.com/I get a random number and show the probability of getting this number. Just math.
You can take this structure and use on your ads. Change the "i" attributes to set your intervals and the percentage as well.
Put the ad code inside "then" and "else" tags.