Loading a background image from array
I have coded in html/php/css, but have not done anything too elaborate. I was looking at a site that had a different image every time on reload. When looking at the source code for the site, I found the following code that was placing the background.
On every reload the "bg002.jpg" portion of the code would change. Can anyone explain a method or script that could be causing this? There is no other code on the page that would refer to an array that the background images are being caller from.
Many thanks in advance!!
If there's no hint of anything in the page source, they're using a scripting language like PHP to randomly select the image filename before the page is rendered in your web browser.
It's the same as doing the following:
When this script is executed and rendered in the browser, you would see only the text "Hello".
$myVar = "Hello";
Similarly, the "bg002.jpg" portion of the page source you're looking at is being printed using some random value. You just can't see the code used to choose the image filename because that processing is done on the server side (before your browser receives a response from the web server); you just see the output of some echo statement.
That helped clear it up! I thought this might be one way to achieve this and just wanted to get an affirmation.
Thanks for all your help. This should help get me started!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread