the-botman Posted November 29, 2009 Share Posted November 29, 2009 Hi i need to know if my code is rite <?php $year = $date('Y'); $xmas = mktime(0, 0, 0, 12, 25, $year); $newyear = mktime(0, 0, 0, 01, 01, $year); $today = time(); if($xmas == $today) { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">Bha Would Like To Wish all his supporters a Merry Christmas </div></div>'; } else if($newyear == $today) { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">Bha Would Like To Wish all his supporters a Happy New Year</div></div>'; }else { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">TV guide Now Added and is updated every 2 min also BhasIRC chat apps are now all updated hope you guys like it</div></div>'; } ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 Does it do what you want it to do? Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 No ... it just gives me a blank screen were the msg should be and there is notting wrong with this part of the code becuase i have it working rite now echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">TV guide Now Added and is updated every 2 min also BhasIRC chat apps are now all updated hope you guys like it</div></div>'; so i tought i some how got my code wrong thats why its not working the way it should and came here to ASK FOR HELP Thanks in advance Botman Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 Well then it is not 'rite' $year = $date('Y'); should be $year = date('Y'); Enable error reporting. If you did, it would tell you that something was wrong with this line. Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 hehe thanks dam how did i miss that Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 its still not working see when i change the date for 2day i still only get the last msg and not the christmas greeting any idea why Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 Because these conditions: if($xmas == $today) if($newyear == $today) Evaluate to true on one second only (at midinight of Dec 25th and Jan 1st respectively). If you want them to be true for the whole day, you have to compare month and day of month. Actually in case of New Year, just check if day of year == 1 Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 so i should just make it like this if($xmas == 1) if($newyear == 1) Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 More like if(date('z') == '0') { echo "It's New Year"; } elseif (date('md') == '1225') { echo "It's Christmas"; } Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 ok so this is rite i am guessing <?php if(date('z') == '0') { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">New Year is meant for celebrations and spending joyous time with loved ones.May the beauty of New Year be with you forever and your wishes of peace,health and happiness ring true.</div></div>'; } elseif (date('md') == '1225') { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">May the spirit of Christmas bring u peace, The gladness of Christmas give u hope, AND The warmth of Christmas grant u love Merry Christmas</div></div>'; }else { echo '<div class="hd5a">'; echo '<div style="display: -wap-marquee; -wap-marquee-loop: 100; font-size: 8pt; color:#666;">TV guide Now updated, BhasIRC chat apps are now all updated hope you guys like it</div></div>'; } ?> thanks for all your help Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 Should be working, but do you understand how? Quote Link to comment Share on other sites More sharing options...
the-botman Posted November 29, 2009 Author Share Posted November 29, 2009 i think so, if the month and day 1225(thats 25th of dec) then it gives the christmas wish and if the date is the 1st day of the 1st month of the year 0 then it wish happy new year or else if any other day it gives the normal greeting Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 29, 2009 Share Posted November 29, 2009 Cool then You pass. 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.