Hi, everybody.
Got a problem with a specific thing. I got lost when trying to make simple header image rotating with 2 other images after refresh.
Want to have different image in header after refreshing a browser and should be linkable as well.
here is the code I need to modify:
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/blue.jpg\')"';
Thanx for help.
Random image on refresh
Moderator: General Moderators
Re: Random image on refresh
I would use a random number for that
this will randomly display an image
images names have to be 1.jpg, 2.jpg and so on
if you want to display images in an order like 1, 2, 3 then use sessions
Code: Select all
$img = rand(1, 3);
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/$img.jpg\')"';images names have to be 1.jpg, 2.jpg and so on
if you want to display images in an order like 1, 2, 3 then use sessions
Re: Random image on refresh
I tried it but got
message...Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING...
Re: Random image on refresh
$img = rand(1, 3);
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/$img.jpg\')"';
oh the code tags displayed the code wrong
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/$img.jpg\')"';
oh the code tags displayed the code wrong
Re: Random image on refresh
I am neither
but ...I figured out that there is one php file called style.php and there is code for this pictures:
where 3.jpg is one of the pictures wanted to be shown. Shouldn,t there be $img.jpg as well???
but ...I figured out that there is one php file called style.php and there is code for this pictures:
Code: Select all
.logotd{
background: #fff url('img/3.jpg') no-repeat;
width: 557px;
height: 135px;
vertical-align: top;
}Re: Random image on refresh
this is a style for use in html <class="logotd"/>
its for something else in your page
EDIT: alright figured it out this should work
$img = rand(1, 3);
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/'.$img.'.jpg\')"';
its for something else in your page
EDIT: alright figured it out this should work
$img = rand(1, 3);
$style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/'.$img.'.jpg\')"';
Re: Random image on refresh
but when I want to change picture manualy I have to overwrite it with the same number I used in previous code....otherwise it wont change