/ Published in: PHP
Pull banner ad or image code from a given text file into an array and randomize the order. Banner/image codes in the file should be separated by tildes (~).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function initializeAds($file) { return $ad_array; } $ad_banners = initializeAds('ad_banners.txt'); echo $ad_banners[0]; // first randomly ordered banner echo $ad_banners[1]; // second randomly ordered banner, etc.