soundeffects Posted November 17, 2007 Share Posted November 17, 2007 And I'd like to ask something? Someone I know told me that they had made a PHP file to show different pictures at different times of the month. But as one file. If that makes sense. I'd like to make one too, would anybody know how to go about it/where to start? I'm not asking for you to write it all out for me, just a little push/shove/kick in the right direction? Thanks. Quote Link to comment Share on other sites More sharing options...
otuatail Posted November 17, 2007 Share Posted November 17, 2007 What you need is to put all your images up. In your page have an array of the names and a use a random number generator to pick the image name out. This can be used to display the picture you want. Not sure if you want a specific image for a specific day? Desmond. Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted November 17, 2007 Share Posted November 17, 2007 Say if you wanted different pictures for different months, you would so something like this.... for more information have about the php data function (http://au3.php.net/date) <?php // Get the month as a digit 0-12 $month = date("n"); switch($month) // Choose which image to display for which month by using a switch more info can be found here(http://au3.php.net/manual/en/control-structures.switch.php) { case $month == 1: echo '<img src="january.jpg" alt="" />'; break; case $month == 2: echo '<img src="february.jpg" alt="" />'; break; // etc.... } ?> Hopefully this helps! Quote Link to comment Share on other sites More sharing options...
soundeffects Posted November 17, 2007 Author Share Posted November 17, 2007 otuatail: Thanks for the reply. What I was thinking was to have an image up for about 28 days of the month and have a seperate image for the other two days. Once those days were over, I'm planning on having it revert back to the original image. dual_alliance: Thanks, that's pretty close to what I want. Is there any way to tweak it so the pictures change on a certain date of the month? Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted November 17, 2007 Share Posted November 17, 2007 Yeah you could do something like.... <?php // Get the month as a digit 1-12 $month = date("n"); // Get the day as a digit 1-31 $day = date("j"); switch($month) // Choose which image to display for which month by using a switch more info can be found here(http://au3.php.net/manual/en/control-structures.switch.php) { case $month == 1: if($day == 23) { echo '<img src="specialImage.jpg" alt="" />'; } else { echo '<img src="normalImage.jpg" alt="" />'; } break; case $month == 2: if($day == 13) { echo '<img src="specialImage.jpg" alt="" />'; } else { echo '<img src="normalImage.jpg" alt="" />'; } break; // etc.... } ?> Probably a more productive way of doing it, but it should help you Quote Link to comment Share on other sites More sharing options...
soundeffects Posted November 17, 2007 Author Share Posted November 17, 2007 Great, thank you. I'll go suss it out now. Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted November 17, 2007 Share Posted November 17, 2007 No problem happy to help. One last thing for you <?php if( ($day == 13) || ($day == 22) ) // This way it would only appear on two certain days, "||" means OR { // special image here.... } // rest of code would follow like above ?> Quote Link to comment Share on other sites More sharing options...
soundeffects Posted November 17, 2007 Author Share Posted November 17, 2007 Okay, so I've tried to not be completely useless, but I'm drowning here. I've downloaded PHP from the website, but I honestly have no idea what to do. :| Quote Link to comment Share on other sites More sharing options...
dual_alliance Posted November 17, 2007 Share Posted November 17, 2007 Yeah a better option would be downloading WAMP. Its a bundle that already has mysql, apache (web server) and php already setup to work with each other. You can download it from http://www.wampserver.com/en/ 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.