PDA

View Full Version : Random Content Order script - non-repeating random content



doomeyes
03-06-2008, 06:00 PM
1) Script Title: Random Content Order script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/randomcontentorder.htm

3) Describe problem: I am using the this script to display text ads in my left navigation and my right navigation. My text ads are all in one include file. This file is included in my left and right nav. Let's say I have 6 ads. Since I have the ads include twice on the page, 6 ads show up on the left, and 6 ads show up on the right, and each ad is repeated twice. How can I modify this so that all 6 ads show up on the page, but only 3 in the left nav, and only 3 in the right, and they do not repeat? Or is this not possible, and it is better to have a separate include for the left and for the right nav, but even if I have two includes, how would you make sure all 6 ads are shown? Thank you.

ddadmin
03-06-2008, 09:38 PM
If all 6 ads are within one external file, and you wish to show 3 randomly on each column, what you can do is give the first 3 one particular CSS class name, and the other 3, a different one, so something like:


<div class="groupa">
Content
</div>

<div class="groupa">
Content
</div>

<div class="groupa">
Content
</div>

<div class="groupb">
Content
</div>

<div class="groupb">
Content
</div>

<div class="groupb">
Content
</div>

On the left column, somehow you will have to call:


<script type="text/javascript">

randomizeContent("groupa")

</script>

And on the right column,


<script type="text/javascript">

randomizeContent("groupb")

</script>

instead.