Howdy all,
I'm using the i-nuka theme on my site (http://nemo.compsoc.com/10k) and I was wondering, has anyone any thoughts on how to randomise the photos that are displayed on the topbar?
ie, a snippet of jscript that selects 4 photos from the images directory.
Thanks in advance for any help!
Doyler
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mazdev responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 05:25 PM
- nestormateo responded to »Fillters in Clip« 06:33 AM
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 03:19 AM
- frw responded to »Bug in the SMTP mail transfer protocol - Port 25 - Zikula 1.2.9« 22. May
- mdee responded to »Short URL questions« 22. May
- mesteele101 responded to »Problem in Database Connection« 21. May
- Herr.Vorragend responded to »Clip Documentation and Doubt« 19. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Random Photo Retrieval
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 365
I'm not familiar with that theme, but I gather you would like to have a folder full of images that are randomly displayed each time the page is called. The easiest way to do that would be to embed a few lines of PHP code into the theme.html page to randomly chose each of four images (making sure they don't repeat).
It a nifty idea for a theme. -
- Rank: Senior
- Registered: Sep 22, 2003
- Last visit: Oct 21, 2009
- Posts: 2774
Here's something I did for a theme (place in the top of the themeheader) that pics from a predetermined list of pics:
// Random header pic
Code
Then just echo 'yourimagedirectory/'.$header_pic...
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
- Rank: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
Yes nice concept Nate, but remember the great thing about themes is the fact that graphics are reused across the entire site; if you put random images in it means that people will have to wait for them to load each time. I guess it wouldn't matter if they were small though :)
regards
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- Rank: Senior
- Registered: Sep 22, 2003
- Last visit: Oct 21, 2009
- Posts: 2774
True enough Lobos, but in all likelyhood, we'd only be talking about 20-30K max per pic, and where it is a limited amount of images, they'd get cached after just a few page views ;)
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
- Rank: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
Point taken :)
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 12
I was writing a theme following Nate´s guidelines ( many, many thanks; I learned a lot from you ) and I needed to do the same thing with 8 small GIFs. I named them header1 to header8, and wrote this:
Code
<img src="header<?=mt_rand(1,8)?>.gif" width="50" height="50" alt="">
I used mt_rand() because it´s four times faster than rand(), and also doesn´t need a seed feed. -
- Rank: Senior
- Registered: Sep 22, 2003
- Last visit: Oct 21, 2009
- Posts: 2774
Now *that's* clever!
Ahhh... the student surpasses the master... :)
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jun 01, 2004
- Posts: 7
Having used the ever wise nate's coding, the site has been running perfect, except for one thing. (Probably something that only bugs me!) Even though the photos to choose from is quite varied, every so often one or two of the photos are the same. Any ideas on how to code it so that if a photo is chosen, that photo is locked out for the rest of the randoms? If you know what I mean!
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
