hi i want to change the header Image using php, i want it so that when it is january it changes the header to a different image ?
if ($date('m') == 01) { echo "january header here"; } else { echo "default hedaer here"; }
i need something like if date = january set Div background image to bg_feb.gif
dvwhi;10903092 wrote:i need something like if date = january set Div background image to bg_feb.gif
coldwerturkey;10903085 wrote:if ($date('m') == 01) { echo "january header here"; } else { echo "default hedaer here"; }
than make the echo <style>body{background:url(bg_feb.gif);}</style> or whatever
I'd suggest you use 1 instead of 01, or you'll have trouble come August.
hi i have done that
<? if ($date('m') == 1) { echo '<style> .navbg{background:url(/images/banners/bg_jan.gif) repeat-x;} </style>'; } else { echo "default hedaer here"; } ?>
but it comes up with Fatal error: Function name must be a string in /home/outwards/public_html/testpage/index.php on line 14
dw i have sorted it i had to do
<?php $d=date("M"); if ($d=="Jan") echo '<style>.navbg{background:url(/images/banners/bg_jan.gif);}</style>'; elseif ($d=="Feb") echo '<style>.navbg{background:url(/images/banners/bg_feb.gif);}</style>'; ?>
thanks
sorry man, I was really dumb when I wrote that, date() is a function not a var
if ([COLOR="Red"][B]$[/B][/COLOR]date('m') == 1) { //... should be... if (date('m') == 1) {
but I'm glad you got it,