Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > General Discussion > General Support

General Support Questions about using the Easy PHP Calendar. (Not installation or customizations)

Closed Thread
 
Thread Tools Search this Thread Display Modes

Won't Correctly Show Month Name When User Hits Next
Old 01-30-2009, 03:45 PM   #1
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default Won't Correctly Show Month Name When User Hits Next

I am having a weird bug occuring with my calendar. When the user hits next month button on the calendar it won't show the month of February in the header. The variable shows it being 2, but March is displayed. You hit next again and it shows March correctly and April if you hit it again.

The Calendar for February is there, but the actual header is wrong.

It's hosted here:

http://www.cosmolava.com/v2/calendar.php

Any ideas? We've had no luck figuring this out. Here is the part that pulls in the custom graphical header based on the month.

Code:
<?php
        
(($_REQUEST['mo']=="") ? ($mo = date("m")) : ($mo = $_REQUEST['mo']));
$epcMonthPic = date("F", mktime(0,0,0,$mo)); //change the "F" for "m" if you want to use numbers
$epcImagePath = "http://www.cosmolava.com/v2/images/"; // the path to your monthly images (keep the trailing slash)
$epcImageExt = "jpg"; // the extension you'll be using for your images
echo "<img src=\"$epcImagePath$epcMonthPic.$epcImageExt\">";          

?>
 

Old 01-30-2009, 09:13 PM   #2
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

Technically, the bug isn't with the calendar (just in case someone else reads this), but with the custom modifications being made.

It's probable that it's because of February possibly being a leap year sometimes, and/or the time change in March.

Because of this, I always use the full mktime function and account for the time change by calling it like:

mktime(3, 0, 0, $mo, 01, $yr);
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 01-30-2009, 10:14 PM   #3
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default

Thanks I'll give it a try and see if that helps. It was doing the same with January last month so I am not sure it's an actual leap year thing.
 

Old 01-30-2009, 10:22 PM   #4
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default

How would I need to modify the above code to incorporate this? I swapped out the portion you mentioned and it broke the script.

That piece of code i posted above is something you guys wrote for me. This modification is actually something you guys helped me incorporate when I first put the calendar into the site a few years ago.
 

Old 01-30-2009, 11:56 PM   #5
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

How does it break the script? Errors? What does it do.?

I am "you guys" and I don't remember writing this code... Maybe another forum user helped?
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 01-31-2009, 09:07 AM   #6
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default

I just replaced the mktime portion in the 2nd line in the code block I have above. That's what broke it.

The thread where this originated is here:
http://www.easyphpcalendar.com/forum...ead.php?t=6782

But in that thread he (ve9gra) referenced another thread that helped with the monthly image portion that is here - It's post #10 in this thread:
http://www.easyphpcalendar.com/forum...ead.php?t=6178

Also I should probably mention that I am not using version 6 of the calendar, still version 5. I wanted to hold off upgrading until we redo the whole site in a few months. If we need to upgrade it though to make this easier I will.

Last edited by audiophreak; 01-31-2009 at 09:17 AM.
 

Old 01-31-2009, 09:25 AM   #7
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

Yeah, that's why I don't remember writing the code; ve9gra did.

Again, what are the error messages? Can't try fix it without knowing what's causing it...
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Old 01-31-2009, 09:29 AM   #8
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default

no error messages... the page just shows up blank.

This portion is above it... Do I need to tweak this part to make the part you wanted me to tweak work?

<?php
(!isset($_REQUEST['mo'])?$mo=date('m'):$mo=$_REQUEST['mo']);
(!isset($_REQUEST['yr'])?$yr=date('Y'):$yr=$_REQUEST['yr']);
$yb=$yr;
$yf=$yr;
$mb=$mo-1;
if ($mb<1) {$mb=12; $yb=$yr-1;}
$mf=$mo+1;
if ($mf>12) {$mf=1; $yf=$yr+1;}

$cmo = date("m");
$cyr = date("Y");
?>
 

Old 01-31-2009, 10:58 AM   #9
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
Default

I actually found my old test file on my server and the issue was present here too. With the recomendation from Brian's first post, I tested it and it works.

The line that's changed is the $epcMonthPic

PHP Code:
<?php
(($_REQUEST['mo']=="") ? ($mo date("m")) : ($mo $_REQUEST['mo']));
$epcMonthPic date("F"mktime(3,0,0,$mo,1)); //change the "F" for "m" if you want to use numbers
$epcImagePath "http://www.cosmolava.com/v2/images/"// the path to your monthly images (keep the trailing slash)
$epcImageExt "jpg"// the extension you'll be using for your images
echo "<img src=\"$epcImagePath$epcMonthPic.$epcImageExt\">";
?>
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
 

Old 01-31-2009, 11:10 AM   #10
audiophreak
Calendar User
 
audiophreak is offline
Join Date: May 2007
Posts: 16
Default

Awesome thanks... Working great now!
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display The Calendar Starting At The Current Month And Not The Previous Month guylevy General 6 04-04-2008 07:59 PM
How to show User ID in calendar post carpsulsos General Support 3 10-25-2007 10:33 AM
How to show previous month? Raider General Support 1 07-30-2007 12:45 PM
List Mode - Show Displayed Month mcfatema General Support 10 10-26-2006 09:35 AM
show event month on page kim General 1 07-18-2005 06:57 AM



All times are GMT -4. The time now is 05:53 AM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |