iversonm Posted June 12, 2008 Share Posted June 12, 2008 ok so i need some help obviously and i am not sure if what i want to do can be done without using flash which i might have to resort to if you guys cant figure it out. what i want to do is use php to layer certain images on a webpage. i have no idea where to even start with this and if you could help me i would be very greatful Quote Link to comment Share on other sites More sharing options...
BrianM Posted June 12, 2008 Share Posted June 12, 2008 Could you please specify and be a little more informative as to what your looking for? Perhaps give an example of what you want done. Quote Link to comment Share on other sites More sharing options...
iversonm Posted June 12, 2008 Author Share Posted June 12, 2008 ok sorry for not being my descriptive. basically i want to create a scene if that makes any sense this scene will change depending on the weather in your area pulling the data from a weather site(code is done and complete) now what i need is a basic background image and then i want to layer images ontop of the main background image the images the layer will be gif or png. basically if the weather outside is cloudy i want it to layer clouds onto it, or raining i want to layer the picture onto does that help any kind of a small example so you would pull the data from yahoo weather $condition = "cloudy"; so i would want to layer the cloud picture onto the main background picture $condition ="snowing"; so i would want to layer on the picutre of snow i dont know if that makes any sense at all grr let me know Quote Link to comment Share on other sites More sharing options...
corbin Posted June 12, 2008 Share Posted June 12, 2008 Seems to me like you should be looking into Javascript/AJAX..... Try googling them, and if you don't get it, I'll try to explain how you could use both. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted June 12, 2008 Share Posted June 12, 2008 [This is not the best solution, but it is A SOLUTION] If the "image sets" are standard per condition, you could break it down and do this: Firstly, I'm assuming you will not have very many weather conditions... -Day/Night background +Cold/Average/Hot temperature +Cloudly/Sunny/Rainy +Tornado/Hurricane/etc.... So you could do a series of CSS includes... <?php if($timeOfDay == 'day') { echo '<link rel="stylesheet" type="text/css" href="day.css" />'; }else{ echo '<link rel="stylesheet" type="text/css" href="night.css" />'; }//assume night if not day //Then for more options of variation use a switch() statement switch($temperature) case 'cold': echo '<link rel="stylesheet" type="text/css" href="cold.css" />'; break; case 'average': echo '<link rel="stylesheet" type="text/css" href="average.css" />'; break; case 'hot': echo '<link rel="stylesheet" type="text/css" href="hot.css" />'; break; ?> etc etc, and just have each of the "group of options" have their images be in the same place, where really it's only replacing a background image. Quote Link to comment Share on other sites More sharing options...
iversonm Posted June 12, 2008 Author Share Posted June 12, 2008 so then in the css file would i just set the background image for each file and say background attachment fixed and position absolute top here like this body { color:#ffffff; background-image: url(http:my url to my image.com); background-attachment: fixed; background-position:center; background-color: #006600; font-size: 10pt; margin-left:5; font-family:Verdana,Arial; font-size: 10pt; table align: center; } and then just change the url for each image location for each css file?? Quote Link to comment Share on other sites More sharing options...
xtopolis Posted June 12, 2008 Share Posted June 12, 2008 Yes, you could make a "main.css" file that had everything ready to go, with divs that had no backgrounds so that they didn't show anything... then in your switch($case) statement / if - else statement include a day.css which could contain only <link rel="stylesheet" type="text/css" href="main.css" /> if($timeOfDay == 'day') { include('day.css'); }else{ include('night.css'); } /* day.css */ div#main_bg { background-image: url('imgs/day.gif'); } /* night.css */ div#main_bg { background-image: url('imgs/night.gif'); } And do that with them. That way it would overwrite whatever value you had to begin with. Please remember that this solution is only viable if you don't have a whole lot of options to worry about, I'd say less than 10-15 in total. If it were to get any more complicated, you should find another approach in order to save yourself a headache. Quote Link to comment Share on other sites More sharing options...
iversonm Posted June 12, 2008 Author Share Posted June 12, 2008 ya tobad, haha i tried it and it was looking so promising but the problem is with doing this is it replacing the previous background image and i need them to layer, someone was saying i would use javascript or AJAX anyone have any other ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.