WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R24 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • random thumb
  • Print
Pages: [1]   Go Down

Author Topic: random thumb  (Read 5146 times)

Offline Bug

  • Posts: 237
random thumb
« on: May 17, 2011, 09:21:59 PM »
anyone knwo a simple way to get a random thumbnail from a product

I am making a t-shirt-shop with t-shirtdesigns available on different colors.. I would love it if the view overview would look different each pageload ...


Logged

Offline Bug

  • Posts: 237
Re: random thumb
« Reply #1 on: May 19, 2011, 05:45:15 PM »
what i did for now:

is there any way I can automatically can create the array that should be randomized?

now I need to have all images named in the same way



Code: [Select]
$thumbrandlist= array("-green.jpg", "-white.jpg", "-blue.jpg", "-black.jpg", "-yellow.jpg");
//echo $thumbrandlist[rand(0,4)];
$thumbrand = "<a href='".$item_link."'><img src='http://www.domainname.com/media/bakery/thumbs/item".$item_id."/".$item['sku'].$thumbrandlist[rand(0,4)]."' border='0'/></a>";




// Replace vars with values
$vars = array('[THUMB]', '[THUMBS]', '[THUMBRAND]', '[IMAGE]', '[IMAGES]', '[TITLE]', '[PRICE]', '[DESCRIPTION]', '[CURRENCY]', '[LINK]', '[TXT_PRICE]');
$values = array($thumb, $thumbs, $thumbrand, $image, $images, stripslashes($item['title']), stripslashes($item['price']), stripslashes($item['description']), $setting_shop_currency, $item_link, $MOD_showroom['TXT_PRICE']);
echo str_replace($vars, $values, $setting_item_loop);
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • random thumb
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2