https://hardcoregames.azurewebsites.net/?page_id=31924
has over 100 compact disks in a store page
so wordpress sucks even more with <iframe> so I am wondering if I should consider some additional code to select a max of 20 CDs for an ad box to eventually be stuffed into a widget
amazon uses javascript which is not that hard to work with, but i was wondering how to leverage resources, now that i have a database server to work with
the goal is to grab 20 unique CDs from a swarm of over 100 and then conjure up a amazon native ad that will work
Code: Select all
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_search_bar = "true";
amzn_assoc_tracking_id = "************";
amzn_assoc_ad_mode = "manual";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_random_permute = "true";
amzn_assoc_rows = "4";
amzn_assoc_region = "US";
amzn_assoc_title = "";
amzn_assoc_linkid = "0d6c8c027673600081f274c6a3abe7f9";
amzn_assoc_asins = "B00004WF5I,B00IN69QEY,B00000I8LG,B00000JMKF,B00ILAWJFU,B00004WF5H,B00000K1I5,B000066EZQ,B003X0NNM6,B000066F2I,B00004YLPU,B00004WF7B,B0000457II,B00000I8LO,B00004U0OV,B00003002J,B000WE4CK8,B00000JT6E,B00000I8LM,B00000I8LH";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>Code: Select all
// Fisher-Yates shuffle model
function shuffle(array) {
var m = array.length, t, i;
while (m) { // While there remain elements to shuffle ...
i = Math.floor(Math.random() * m--); // Pick a remaining element ...
t = array[m]; // And swap it with the current element...
array[m] = array[i];
array[i] = t;
}
return array;
}
Code: Select all
Array.prototype.swap = function (x,y) {
var b = this[x];
this[x] = this[y];
this[y] = b;
return this;
}
then pick the first 20 with each page load