Click here to register.
      
irc://irc.freenode.net#webgui

iPhoneGuy: WebGUI is a pile of crap.
rizen: If WebGUI is such a pile of crap, why do you use it?
iPhoneGuy: Because it's the best pile of crap out there.

If this is what people who hate us are saying, imagine what people who love us will say. Come join us on IRC.


     Discuss > Web Design, Templates, and Themes

Random Image in Stylesheet

User philadev
Date 1/22/2008 12:02 pm
Views 781
Rating 2    Rate [
|
]
Previous · Next
User Message
philadev

I have to admit i'm doing alot at once right now so I apologize if there is a simple answer to this question that I'm just not seeing.

Is there some way to generate a random image URL for a CSS class?

I'm developing a template and I want it to have a banner that can be customized by our content managers to do one of three things:

  1. Leave as is (randomly include default images in banner from a pre-existing directory via css)
  2. Customize (upload custom images to a pre-determined directory to be included via css)
  3. Custom Randomize (upload multiple images to a pre-determined directory to be included via css)

The way it works is that we have a PHP script that collects the user preferences. If the user has images in a preset directory they can choose to use their images in place of the defaults and upon choosing to use custom images they can choose to make it random or static.

The problem is that the template needs to be a flexible layout. So, the images need to be set as backgrounds for a given DIV. Which in turn means they need to be set via a css declaration.

As it stands now I have a default stylesheet that  sets a static banner image and I'm using an inline stylesheet declaration to override the banner class if they choose a custom image.

That much is easy enough, however, getting those images randomly requires 'RandomAssetProxy' which returns an image tag not a URL.

So, to state the problem simply; I need a way to pull a random asset's URL into a CSS class.

Any advice?

-Nate 

--- (Edited on 1/22/2008 12:02 pm [GMT-0600] by philadev) ---



Back to Top
Rate [
|
]
 
 
preaction
Change the Image template so that the RandomAssetProxy returns just the URL?

--- (Edited on 1/22/2008 12:48 pm [GMT-0600] by preaction) ---



Back to Top
Rate [
|
]
 
 

Re: OReilly by koen - Sat @ 06:44pm

Re: OReilly by JT - Sat @ 12:46pm

Re: Glad to be here by Mike_S - Sat @ 09:11am

Partner Marketing Goals? by koen - Sat @ 08:15am

Re: OReilly by koen - Sat @ 08:07am

Re: Glad to be here by koen - Sat @ 08:05am

Re: WebGUI Drinks by Albert2 - Sat @ 05:06am