Jurik Posted December 11, 2006 Share Posted December 11, 2006 Hi guys, I've been asked to add a radom image generator to a site that is using Mambo to create it's web-site in. At the moment the image that is needed to become a random image is using the following code [code]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header.jpg" alt="header image" />[/code] Now I have tried to add some scripts I have found on the net to make this image randomly selected but I just cant seem to get it to work, can anyone help me out? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted December 11, 2006 Share Posted December 11, 2006 well you how much other images are there. i am guessing you are changing img_header.jpg?well just have a couple of those with a number on the end. then use the rand.[code=php:0]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header<?php echo rand(1, 4); ?>.jpg" alt="header image" />[/code]remember to change the 4 to however many images there are. Quote Link to comment Share on other sites More sharing options...
Jurik Posted December 11, 2006 Author Share Posted December 11, 2006 [quote author=ProjectFear link=topic=118168.msg482584#msg482584 date=1165838603]well you how much other images are there. i am guessing you are changing img_header.jpg?well just have a couple of those with a number on the end. then use the rand.[code=php:0]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header<?php echo rand(1, 4); ?>.jpg" alt="header image" />[/code]remember to change the 4 to however many images there are.[/quote]Thats works a treat, thanks alot Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted December 11, 2006 Share Posted December 11, 2006 no problems. glad i could help. :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.