rocknbil - 4:47 pm on Dec 15, 2011 (gmt 0)
Some servers define the environment variable "DOCUMENT_ROOT" with a trailing slash. It's often done using php's rtrim. Doesn't matter though, PHP doesn't work for you.
Even if it did, PHP is a rich server side programming language, overkill for something as simple as an include. I'd use SSI instead.
Add this to your .htaccess at root:
AddHandler server-parsed .html
Test it like so. Create a file "test.txt"
In any html file, add
You should see hello world below:<br>
<!--#include virtual="/test.txt" -->
Upload both to your server, request the html file. If it works and you indeed see "hello world" below the first line, you have enabled SSI's for .html files.
note: if you're using .htm, not .html, use that extension in the AddHandler directive.
So from there you just do this in your files. Create your include - "rotating-img.txt"
<div id="rotating image">
<p><img src="/images/myimage.jpg?cachebust=1234" alt="My Image"></p>
<p id="caption">This is my caption</p>
Style it appropriately in your CSS.
In your 47 files, and any forward, add
<!--#include virtual="/includes/rotating-img.txt" -->
Assuming you've put it in the /includes directory.
Now you only have to modify the single file, rotating-image.txt, to update all pages.
A note about this bit,
An image is a static resource, the browser will throw away the query string and it won't affect it's display - but when the image changes, it may not "recognize" it's a new image if you use the same file name. So when you modify the image, you change the parameter,
... and the browser is forced to download a fresh copy of the image. Hence, "cachebuster."