DarkDragonLord
New Member
- Messages
- 782
- Reaction score
- 0
- Points
- 0
Greetings everyone
Well, here its a fully commented PHP Script that allows you to create a rotative banner and yet, set up the href/link to the website.
I did not made it but i did translated all comments since were in PORTUGUESE.
Remember to set the width and height, this way, if you just want 468x80 banners, if any "smart" one changes it banner to a 1024x768 to **** your webpage, it will not show full size, just the size you setup'ed
And i added the alt array just now so, i think will work perfectly, if not, let me know.
Credits:
http://www.baboo.com.br/absolutenm/templates/content.asp?articleid=5220&zoneid=24&resumo=
Well, here its a fully commented PHP Script that allows you to create a rotative banner and yet, set up the href/link to the website.
I did not made it but i did translated all comments since were in PORTUGUESE.
PHP:
<?php
$banners = array('http://ddl.exofire.net/images/banner2.gif','http://ddl.exofire.net/images/468x80_banner.gif');
/* here is where is created the variable array type where you will be inserting the name of the images. FULL URL, */
$totalbanners = count($banners);
/* Here we use the count instruction to check the number of images inside the variable $banners */
$totalbanners--;
/* here we make a recount of the total number returned by the count, because an array starts with index 0 */
$randombanners = rand(0,$totalbanners);
/* the rand instruction ramdomly picks one image number generated by the count */
$link = array('www.google.com.br','ddl.exofire.net');
/* variable array type, that we define what is the URL of the HREF in the images. you must put in same order of the images.. NO NEED the http:/ because in the echo, we already add it. */
$alts = array('its google lol','my website');
echo "<a href=\"http://$link[$randombanners]\">
<img border=\"0\" width=\"yy\" height=\"xx\" src=\"$banners[$randombanners]\" alt=\"$alts[$randombanners]\">
</a>";
// ok, here we show the image ;P try it pressing F5 in your webpage ^^
?>
Remember to set the width and height, this way, if you just want 468x80 banners, if any "smart" one changes it banner to a 1024x768 to **** your webpage, it will not show full size, just the size you setup'ed
And i added the alt array just now so, i think will work perfectly, if not, let me know.
Credits:
http://www.baboo.com.br/absolutenm/templates/content.asp?articleid=5220&zoneid=24&resumo=
Last edited: