4 out of 4 members found this post helpful.
Tutorial banner rotator php
Probabil multi dintre voi stiu sau vi se pare banal dar cred ca pentru unii va fi folositor.
Este vorba de banner rotator folosit in cazul meu pentru a afisa bannerele afiliate.
Varianta simpla:
Cod PHP:
<?php
$ban1 = "<object><param name='movie' height='90px' width='728px' value='http://img.2parale.ro/system/paperclip/banner_pictures/pics/96186/original/96186.swf?clickTAG=http%3A%2F%2Fevent.2parale.ro%2Fevents%2Fclick%3Fad_type%3Dbanner%26aff_code%3D25808a9ec%26campaign_unique%3D7d2646cd6%26unique%3D25142b8e5'/><PARAM NAME='menu' VALUE='false'><PARAM NAME='quality' VALUE='medium'><PARAM NAME='wmode' VALUE='Opaque'> <embed src='http://img.2parale.ro/system/paperclip/banner_pictures/pics/96186/original/96186.swf?clickTAG=http%3A%2F%2Fevent.2parale.ro%2Fevents%2Fclick%3Fad_type%3Dbanner%26aff_code%3D25808a9ec%26campaign_unique%3D7d2646cd6%26unique%3D25142b8e5' menu='false' swLiveConnect='FALSE' wmode='Opaque' height='90px' width='728px' TYPE='application/x-shockwave-flash'></embed></object>";
$ban2 = "<a href='http://event.2parale.ro/events/click?ad_type=banner&aff_code=25808a9ec&campaign_unique=f8b9126a2&unique=0859fb8b2' target='_blank' rel='nofollow'><img src='http://img.2parale.ro/system/paperclip/banner_pictures/pics/103352/original/103352.jpg' alt='TinaR - VIP' title='TinaR - VIP' border='0' /></a>";
$ban3 = "<a href='http://event.2parale.ro/events/click?ad_type=banner&aff_code=25808a9ec&campaign_unique=57f3b5c31&unique=a64d57478' target='_blank' rel='nofollow'><img src='http://img.2parale.ro/system/paperclip/banner_pictures/pics/98370/original/98370.jpg' alt='Slim&Fit.ro' title='Slim&Fit.ro' border='0' /></a>";
$ban4 = "<object><param name='movie' height='90px' width='728px' value='http://img.2parale.ro/system/paperclip/banner_pictures/pics/84432/original/84432.swf?clickTAG=http%3A%2F%2Fevent.2parale.ro%2Fevents%2Fclick%3Fad_type%3Dbanner%26aff_code%3D25808a9ec%26campaign_unique%3D2e49eab4f%26unique%3D716278e05' /><PARAM NAME='menu' VALUE='false'><PARAM NAME='quality' VALUE='medium'><PARAM NAME='wmode' VALUE='Opaque'> <embed src='http://img.2parale.ro/system/paperclip/banner_pictures/pics/84432/original/84432.swf?clickTAG=http%3A%2F%2Fevent.2parale.ro%2Fevents%2Fclick%3Fad_type%3Dbanner%26aff_code%3D25808a9ec%26campaign_unique%3D2e49eab4f%26unique%3D716278e05' menu='false' swLiveConnect='FALSE' wmode='Opaque' height='90px' width='728px' TYPE='application/x-shockwave-flash'></embed></object>";
$random = rand (1,4);
$reclama = ${'ban'.$random};
print $reclama;
?>
Varianta avansata:
Cod PHP:
<?php
function BannerRotator($ban1, $ban2, $ban3, $ban4) {
$random = rand(1,4);
return print ${'ban'.$random};
}
?>
// Afisare
<?php BannerRotator($ban1, $ban2, $ban3, $ban4); ?>
$ban1, $ban2, $ban3, $ban4 sunt codurile pentru bannerele pe care vreti sa le afisati.
Pentru mai multe bannere adaugati mai multe variabile {$ban} si modificati $random = rand(1, NR DE BANNERE).
Atentie:
Verificati codurile bannerelor sa nu contina caracterul " .
2 out of 2 members found this post helpful.
stripos - poate intoarce o valoare ce e interpretata ca false, asa ca in php a aparut operatorul ===
deci corect ar fi stripos($titlu, "automobile") === true si tot asa pentru celelalte