Here is the code that I am currently using... (javascript injection)
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
}
var imgList = [
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg',
'img/1.jpg', 'img/1.jpg' // Note: No comma after last entry
];
function showImage() {
var today = new Date();
var weekno = today.getWeek();
document.getElementById('WeeklyImage').src = imgList[weekno];
document.getElementById('WeeklyImage').alt = imgList[weekno];
// alert(weekno+'\t'+imgList[weekno]);
}
I was wondering if someone can tell me how I convert the image src to a php variable like $weeklyImage or something like that so I can do the following...
echo "<img src='" . $weeklyImage . "'>";
I need the output to be in PHP so that I can use the variable for other areas of the site that require PHP functions.
If not possible, any other suggestions would be appreciated.
Thanks!