Hi all.
I have the following code from the Layout: Top menu + 2 columns stylesheet in v 1.2.3 Black Rock
div#header h1 a {
/* you can set your own image here */
background: #385C72 url(uploads/images/banners/banner_1.jpg) no-repeat 0 1px;
display: block;
height: 87px; /* adjust according your image size */
text-indent: -999em; /* this hides the text */
text-decoration:none; /* old firefox would have shown underline for the link, this explicitly hides it */
}
Is there anyway I can randomise the choice of that image. I have a couple of ramdomising methods, but the
url(uploads/images/banners/banner_1.jpg)
fouls them up.
Andrew
Randomise Banner Graphic
Re: Randomise Banner Graphic
Have you looked in forge for a random image module?...
-
- Forum Members
- Posts: 248
- Joined: Sun Oct 28, 2007 4:14 am
Re: Randomise Banner Graphic
Yes, doesn't work in this context unfortunately
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Randomise Banner Graphic
Using this thread (in the tips & tricks forum): http://forum.cmsmadesimple.org/index.php/topic,15706.0.html
You could do something like this:
You could do something like this:
Code: Select all
{capture assign='num'}{1|rand:10}{/capture}{* generate a random number between 1 and 10, assign it to 'num *}
<div id="background" style="background #385C72 url(uploads/images/banners/banner_{$num}.jpg) no repeat 0 1px"></div>
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Randomise Banner Graphic
Try image rotator by Alby
You can't use it for bg images, but it will randomize 's
You can't use it for bg images, but it will randomize 's
-
- Forum Members
- Posts: 248
- Joined: Sun Oct 28, 2007 4:14 am
Re: Randomise Banner Graphic
Hi Calguy.
I use your random image code a lot; it's extremely useful, thanks.
But it will not work in this location. It seems not to parse the code when I put {$num} in place of the file name. There is simply no image appears. I've assumed that this is because it is in a stylesheet rather than in a template.
Andrew
I use your random image code a lot; it's extremely useful, thanks.
But it will not work in this location. It seems not to parse the code when I put {$num} in place of the file name. There is simply no image appears. I've assumed that this is because it is in a stylesheet rather than in a template.
Andrew
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Randomise Banner Graphic
if you look at the example above.... I'm using doing it all in HTML by passing an additonal style attribute on the div. and smarty will work there.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.