[x] Contributions
Due Date: May 31
May Goal: 50.00
Gross Amount: 0.00
PayPal Fees: 0.00
Net Balance: 0.00
Below Goal: 50.00
Site Currency: USD
 0%

[x] Main Menu

[x] User Info

Welcome Anonymous

Nickname
Password

Membership:
Latest: GalloInfligo
New Today: 0
New Yesterday: 0
Overall: 13

People Online:
Members: 0
Visitors: 1
Total: 1
Who Is Where:
 Visitors:
01: Support Forums

Staff Online:

No staff members are online!

[x] Preview theme
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.

[x] Shopping Cart
Your cart is empty.

[ Browse ]

Rotating Image in Header

Author Message
rlgura
Site Admin


Joined: Dec 13, 2007
Posts: 25
Location: Cleveland, OH USA

PostPost subject: Rotating Image in Header
Posted: Wed Oct 08, 2008 7:59 pm
Reply with quote

This will display a random image from a pre-defined list of images

Credit for this code goes to Kristin of Dragonflied.com

Step 1:
Create a folder/directory called "random" in your theme's images directory and place all the images you want in there.
For example the path you'll be using to call your random images will be: yourtheme/images/random/01.jpg

Step 2:
In yourtheme/theme.php, add the following 2 variables ($array and $image) and add the 'RAND_IMG' var to assign_vars block

Array:
// random image at top in header
$array = array('01.jpg', '02.jpg', '03.jpg');
$image = rand(0, count($array)-1);

$cpgtpl->assign_vars(array(
    'RAND_IMG' 	   => $array[$image],
Don't forget to specify the image filenames you want in the array. Replace 01.jpg etc... with your images.

Step 3:
In yourtheme/template/header.html (or whatever template file you want to have a rotating image use the following code.
Array:
<img src="{THEME_PATH}/images/random/{RAND_IMG}"  alt="" border="0" />

_________________
Site Admin - Great Lakes Web Designs
Theme Designer - WebSite Guru Designs
Site Admin - Families with Food Allergies
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page    Forum Index Dragonfly Theming Tips & Tricks
Page 1 of 1
All times are GMT



Jump to:  


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster
Interactive software released under GNU GPL, Code Credits, Privacy Policy