website header with random images on php

1) first create a folder with images to show into your website header.

2) rename images with names combined with numbers, example: header1.jpg, header2.jpg, header3.jpg ……

3) copy and paste this code into you php document before of <head> and edit with your settings

<?php
//this made a random from 1 to 3
$random = mt_rand(1, 3);
$header_rotator = ‘#header{width: 800px; height: 120px; background:url(headers/header’.$random.’.jpg) no-repeat; }’;
?>

4) now before </head>  paste this code:

<style type=”text/css”>
<?php
echo $header_rotator;
?>
</style>

5) into your document after <body> in the place that you want see your new header:

<div id=”header”></div>

Ready ;)

//

1) crear una carpeta con las imagenes a mostrar en la cabecera.

2) renombrar las iamgenes con nombres convinados con numeros: header1.jpg, header2.jpg, header3.jpg ……

3) copiar y pegar esto antes de la etiqueta <head>y editar con tus preferencias

<?php
//esto genera un random de  1 a 3
$random = mt_rand(1, 3);
$header_rotator = ‘#header{width: 800px; height: 120px; background:url(headers/header’.$random.’.jpg) no-repeat; }’;
?>

4) ahora antes de la etiqueta </head>  copiar esto:

<style type=”text/css”>
<?php
echo $header_rotator;
?>
</style>

5) dentro del documento despues de  <body> (en el lugar que pretendas mostrar el header):

<div id=”header”></div>

listo! ;)

  1. No comments yet.

  1. No trackbacks yet.