I think your path isn't correct.
Try something like this instead:
body { background: url(mysite/images/background-{$RandomBackgroundNumber}.jpg) 20% 20% no-repeat; }
Just put the path to the images in there, relative to your website root.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I think your path isn't correct.
Try something like this instead:
body { background: url(mysite/images/background-{$RandomBackgroundNumber}.jpg) 20% 20% no-repeat; }
Just put the path to the images in there, relative to your website root.
As a test I did the full images directory root with this:
(this is what the URL looks like until I activate DNS)
<style type="text/css">
body { background: url(http://sonic.net/~carrera/carrera-marble.com/themes/carreramarble/images/background-{$RandomBackgroundNumber}.jpg) 20% 20% no-repeat; }
</style>
still does not display a background.. thoughts? or did I do that completely wrong?
Uhh. looks fine to me.
Although relative paths like I described should work just as well.
Please have a look at the (generated) source code of the Page and tell us how your css style looks there...
yeah it looks fine because it was HAHA.
I looked at the source code and it was calling to background-5.jpg
and I only have background-1 through 3.
How can I tell it I only have 3 backgrounds?
function RandomBackgroundNumber() {
return rand(1, 3);
}
I did that because the original had a 6 there. But it still wants to look higher than 3.
Thank you SO much for the help here!