Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
My website's background image is changing on every page refresh with some random image out of gallery.

I have uploaded about a hundred more pics to the gallery of backgrounds and some are not looking good, some are looking great. I will save good to a folder 'like' and bad to a folder 'trash'.

Of course, go to backend is stupid to manipulate images, especially if you are a nerd programmer and can do a button on a frontend. It will be a button 'like' and a button 'trash'

First, let's show a picture.
CSS is embedded, so it's not an issue:
Get a folder:
Code: Select all
<cms:pages masterpage='globals.php' limit='1' >
  <cms:set g_wallpaper_folder       = wallpaper_folders           scope='global' />
</cms:pages>


Get an image:
Code: Select all
<cms:pages masterpage='_assets/php/wallpapers.php' limit='1' folder=g_wallpaper_folder orderby='random' >
      <cms:set g_background_image = gg_image scope='global' />
      <cms:set g_background_id = k_page_id scope='global' />
</cms:pages>


Show css:
Code: Select all
body { 
  background: url('<cms:show g_background_image />');
  background-size: cover;
}

--end of part1
--part 2

It was meant to be much longer, but I got tired of experimenting and I will simply say:

If you want to manage dynamic data, which is reloaded on every page refresh, don't do it. Absolutely unreliable.
2 posts Page 1 of 1