Is it possible to make the image fader either choose random images or use a "last uploaded, first displayed" (LIFO)? When the page opens, the fader always starts with the first uploaded image and rotates through the gallery in uploaded order (FIFO).
I've looked at BLOCK_MAIN_IMAGE_FADER.tpl, but I don't see anything that allows what I want. But then again, I know just enough about this to really screw up my site!
$image_rows=$GLOBALS['SITE_DB']->query_select('images',array('thumb_url','add_date'),array('cat'=>$cat),'ORDER BY add_date DESC',100/*reasonable amount*/);
Note that I haven't tested it, but I can't think of any reason why it wouldn't work.
Thanks, temp, for your help.
I can think of one reason why it didn't work: you're working with an older version and the syntax is different. But anyway, once I seen it was just a database query, I played around with the ORDER BY clause but just kept getting parse errors. Here's the code:
$image_rows=$GLOBALS['SITE_DB']->query('SELECT id,thumb_url,url,title,comments FROM '.get_table_prefix().'images WHERE '.$cat_select,100/*reasonable amount*/);
I added "add_date" to the SELECT string and placed the "ORDER BY add_date DESC" (with proper quoting) in different spots but nothing seemed to work. Any suggestions where to stick it? (Careful how you answer that one! ) I'm sure I need to change the ORDER BY clause a little but I'm not sure to what.
I should add, only the first image shown is random, after that they're shown in order. I think a truly random order would require no caching and a db call for each image being displayed, unless all the images (file names?) could be put into an array and randomly chosen from that array.
If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
If so, please let others know about ocPortal whenever you see the opportunity.
If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.