0

Well i need to change my banner of the website alternatively , like once user experiences
the pic1 which would be incorporated in my CSS. But the point is i want that pic to change .
for example
when user 1st time logs in , he see pic1 as a banner and next time or for other user , he might see a different banner ex pic2 . so in a given set of pics pic1 , pic2 , pic3 as banners , the banner keeps changing .

well i am not able to think on how to proceed since the banner link is in my CSS . have no idea on how to collaborate CSS + PHP

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by rahul8590
0

Logic:

i) Generating a random numbers(1-10) between no of images (EX:pic1,pic2,pic3...pic10)
ii) Use the echo "<img src='"."pic".random(1-10)."'/>" in php
iii) Now it will generate different images on every refresh.

0

to have php in your 'style.css' file is not difficult,
rename style.css style.css.php
link to it as <link rel="stylesheet" type="text/css" href="/style.css.php"> first line of style.css.php <?php header ('content-type:text/css'); ?> file will be parsed as php but outphut as css, then you can use any php to rotate the image in body { background :url(<?php image rotator ?>); } or do anythinbg else to the css you want on the server, the stylesheet downloaded will remain in the .tif for the duration of the seesion but be refreshed on next login, with a different background

Edited by almostbob: n/a

0

firstly sorry for late reply , i didnt get any notification in my mail that someone has replied ( usually never happens ) .
I will try both the techniques , i appreciate both of you . for ur help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.