vendredi 8 septembre 2017

One header but with different banners for each page (php if)

I build my website for fun and want to put different banner on each page, in my header i have random banners who appear with this code,

<div style=' height:145px; background-image:url(images/banners/banner<?php 
echo rand(1,3); ?>.jpg); background-position:center center; border-
radius:4px;'></div>

So there is 3 banners and each time i refresh random one appear, but i want to have another 3 banners for my other page but with the same include"inc/header.php", maybe 'if' statement could work but i really don't know how to do it. Sorry for my English i'm french.

Aucun commentaire:

Enregistrer un commentaire