Once you guys told me I could rotate ads by doing this:<br/><br/>
<n.if.equal value1="[n.random max='2'/]" value2="1"> <then> <a href="http://www.avantlink.com/click.php?tt=ml&ti=60093&pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a> </then> <else> <script type="text/javascript"><!-- google_ad_client = "ca-pub-0156740191883467"; /* Leaderboard (Forum) */ google_ad_slot = "9529659947"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </else> </n.if.equal> But it seems to show both ads. What am I doing wrong? How would I rotate three ads in various percentages?
HTTPS Please!
|
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.
My test forum.
|
I'm sorry Pedro I don't understand this. If you could show me how the final code would look I will try it.
HTTPS Please!
|
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.var name='rand_num'/> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then>CODE FOR AD #1 to be shown at 25%</then> <else.if.is_less_than i="65"> <then>CODE FOR AD #2 to be shown at 40%</then> <else>CODE FOR AD #2 to be shown at 35%</else> </else.if.is_less_than> </n.if.is_less_than> Is this right? And then a rotation of TWO ads would be: <n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.var name='rand_num'/> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then>CODE FOR AD #1 to be shown at 25%</then> <else>CODE FOR AD #2 to be shown at 75%</else> </n.if.is_less_than> ??
HTTPS Please!
|
It must be something like this:
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then>CODE FOR AD #1 to be shown at 25%</then> <else>CODE FOR AD #2 to be shown at 75%</else> </n.if.is_less_than> </n.int.>
My test forum.
|
This code:
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then><a href="http://www.avantlink.com/click.php?tt=ml&ti=60093&pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then></then> <else><script type="text/javascript"><!-- google_ad_client = "ca-pub-0156740191883467"; /* Leaderboard (Forum) */ google_ad_slot = "9529659947"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> Seems to give me both ads at the same time.
HTTPS Please!
|
This post was updated on .
This is not the structure I gave you. You have two closing "then" tags. No ending "else" nor ending "int".
My test forum.
|
This is hopefully closer to correct, but still not correct based on results.
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then><a href="http://www.avantlink.com/click.php?tt=ml&ti=60093&pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then> <else> <script type="text/javascript"><!-- google_ad_client = "ca-pub-0156740191883467"; /* Leaderboard (Forum) */ google_ad_slot = "9529659947"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </else> </n.int>
HTTPS Please!
|
Where are you using that?
My test forum.
|
Here: http://forum.nyskiblog.com/Ad-Rotation-Test-v2-td4031630.html
HTTPS Please!
|
But where is the code?
My test forum.
|
Here is the code:
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.> <n.int. i="[n.var name='rand_num'/]"> <n.if.is_less_than i="25"> <then><a href="http://www.avantlink.com/click.php?tt=ml&ti=60093&pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then> <else> <script type="text/javascript"><!-- google_ad_client = "ca-pub-0156740191883467"; /* Leaderboard (Forum) */ google_ad_slot = "9529659947"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </else> </n.int>
HTTPS Please!
|
I mean, where in your forum you added this code?
My test forum.
|
I pasted it in a post. I guess that is not a legitimate way to test it. I was trying to avoid bringing the site down if I made an error.
HTTPS Please!
|
Free forum by Nabble | Edit this page |