/    Sign up×
Community /Pin to ProfileBookmark

PHP Calendar Script

Afternoon…!

I’ve found a I’ve found a simple [URL=http://www.phpfreaks.com/tutorials/83/0.php]PHP Calendar Script[/URL] which I really like and could use…. but it doesn’t work properly.

Try it [URL=http://www.phpfreaks.com/cal2.php]here[/URL]

As you scroll forward and back through the months, you can see that today’s date remains highlighted regardless of what month you’re in.

The script is short ([URL=http://www.phpfreaks.com/tutorials/83/4.php]it’s here)[/URL] and, I thought simple to fix! But I’ve been messing for a day and a half to no avail – clearly beyong my skills!

Anyone fancy having a go – I’m convinced it’s easy!

Simon

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 04.2006 — Not sure, but the first thing I'd try is changing this (line 169 in my editor):
[code=php]
if($date == mktime(0,0,0,$month,$d,$year)){
[/code]

To this:
[code=php]
if(date('Ymd', $date) == date('Ymd')){
[/code]
Copy linkTweet thisAlerts:
@SFADuncanauthorMar 06.2006 — Thanks....

I seem to have solved it by putting this up top:

[code=php]$datetoday = mktime(0,0,0,date('m'), date('d'), date('Y'));[/code]

and changing the very line you suggested to:

[code=php]if($datetoday == mktime(0,0,0,$month,$d,$year)){[/code]

Appreciate your help - time functions tend to throw me a bit...

Simon
×

Success!

Help @SFADuncan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...