Rotating Banner: Difference between revisions

From HAA Best Practices Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 9: Line 9:
<?php echo rand(1,1) ?>.jpg)
<?php echo rand(1,1) ?>.jpg)


That code will randomly display just image 1.jpg.  You could change it to display three images, say, by using:
That code will randomly display just image HRGenericPhoto1.jpg.  You could change it to display three images, say, by using:


<?php echo rand(1,3) ?>.jpg)">  
<?php echo rand(1,3) ?>.jpg)">  

Latest revision as of 03:21, 17 January 2009

WARNING: This page assumes at least some familiarity with PHP and html.

You can create a rotating page-top banner by editing the file:

..\templates\lavinya6\index.php (starting at the root of your web site)

You can find the right section to edit by searching for "echo rand". The search will land you in the middle of a line that includes the code:

<?php echo rand(1,1) ?>.jpg)

That code will randomly display just image HRGenericPhoto1.jpg. You could change it to display three images, say, by using:

<?php echo rand(1,3) ?>.jpg)">

You should place your new image files (HRGenericPhoto2.jpg, HRGenericPhoto3.phg...) in the directory:

..\templates\lavinya6\images (starting in the root directory of your site)

See Page-Top Banner for information on how to create a new banner image.

Return to Design How-To's