Design and CSS styles
Version 3.x > Design and CSS styles > Displaying different image on page refresh View modes: 
User avatar
Member
Member
Darren - 7/28/2009 11:32:51 PM
   
Displaying different image on page refresh
Hello,

Kb Article

I read with interest this article in the KB however I have no idea how to actually do it. Clear as mud. I'm a Kentico rookie and I would like to do this - any chance someone could some provide a step by step method?

We have the CMS all set up with editable images however some of these images we want to randomly pick from a folder rather then the same image.

So do I need to add a webpart to the background image zone? Or do I need to modify the editableimage.ascx.cs?? I'm lost please help...

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 7/29/2009 12:56:15 AM
   
RE:Displaying different image on page refresh
Hi,

First of all, I would suggest you to create document structure in your content tree in CMS Desk. For example:

- root
- Home (CMS.MenuItem)
- Folder(CMS.Folder)
-- File1 (CMS.File)
-- File2 (CMS.File)
-- File3 (CMS.File)

Then you can place repeater web part for example on your master page (root) in design mode in CMS Desk. You can ten configure it in following way:

Path: /Folder/%
Document types: CMS.File
Transformation: CMS.File.ImageGallery_thumbnails200
Order by: NEWID()
Select Top N documents: 1

In this way, your repeater web part should display random image from folder section where your files are stored. This is just an example, so you might need to adjust some settings by yourself.

Best Regards,
Miroslav Remias.