-
- 107 Posts
Hello I was trying to get the randombackgroundimage snippet to work.
I would like a different header image displayed (or the appearance of at least) as someone navigates the site.
Now, I was going to just add a script but then I saw there was a snippet. However I cannot get the snippet to work right.
Instead of showing the image, it shows the path to the image. It does appear to at least call a different path as I navigate. But obviously thats not what I want it to do. The output is html. I dont have any tables so Im not sure how to implement it.
Anyone have any success with this snippet or similar?
TY
-
- 4,213 Posts
The snippet returns
background=’path/to/image.jpg’ width="69" height="69" to use in table cells, but change it to the desired output in the last line of the snippet code, so for example:
Change it to:
return 'background:url($image_name)';
So you could use it in the style attribute of your div.. <div style="[[RandomBackgroundImage]]"></div>
Or change it to:
return 'src='.$image_name.' '.$imgSize[3];
So you can use it in a <img> tag.. <img [[RandomBackgroundImage]] />
Or change it just to:
So that it returns just the path and you can use it anywhere you want..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 4,213 Posts
Oh yea, sorry, that supposed to be return ’background:url(’.$image_name.’)’; but double quotes works just as well.. glad that I could help.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."