![]() |
Mini Calendar
Mini Calendar
What it does: The Mini Calendar is just what it's name says. It allows you to add a small calendar to any or all vBulletin page(s). It links back to the month, next and previous month as well as any days with an event. Is it complicated? Installation is easy. Just include the cal.php file on any page that you want it shown, make one new template and insert $smallcalendar at the exact place you want it shown. Look at the instructions below. Changes: New files (1): cal.php Changed files(0-1): depending on where it should be shown New database fields/tables(0): none New templates(1): small_calendar Changed templates(1-2): wherever mini calendar should be shown (phpinclude_start, if shown on all pages) New phrases(0): none Screenshots: see attachmentsInstructions:
Install: Don't feel like donating, but still want to thank me for my work? Click the install button to show your appreciation. As a great side effect, you'll get an email update once there is a bigger update or important security fix! Updates: 10.08.2004: Updated cal.php to fix (hopefully) the events being on the wrong day with far out timezones. |
Tips and Tricks
But its... *english*?!? To translate the few hardcoded dayvalues, go to lines 21-27 and edit the Su, Mo Tu, We, Th, Fr, Sa values near the end of each line to your liking. DON'T change these values if you think there's a problem with the first day of the week! The script checks on the browsing users start of week day and changes the mini calendar so that the day is also all the way on the left! German: PHP Code:
PHP Code:
If you have more than one calendar and would like mini calendar to pull the events from a different calendar, do the following:
|
thanks for the final release!
|
Hi Colin,
Excellent work, but the single all-day events still do not appear correctly for me (and others). Example: A single all-day event on August 20th appears on the Mini Calendar on August 19th, thereby resulting in an incorrect link and a "no events to display" error from the calendar. Using a ranged event works fine, but all-day events result in erroneous links to the previous day every time. FYI I did a straight, simple install, with no modifications. Any help would be great, as I love the idea. |
S***!
Ok... I'm thinking it has something to do with your timezone. what timezone are you in? |
Hmm
I'm PST... (-8:00) |
I have an idea... but I don't have access to phpmyadmin here at work. I'll look at it when I come home :)
|
To be clear ... the .php I alter should look like:
require_once('./global.php'); include ("cal.php"); Is this correct? So far I'm having trouble getting this to work, so I wanted to clarify. Thanks. |
Quote:
|
Regarding the all-day-event bug--
I'm no PHP or vBulletin expert, but it seems strange that a different time zone would be causing a problem that seems to only deal with dates, not times. I could be wrong tho... mostly I just want my mini-calendar up and kicking :squareeyed: |
If someone with this problem could give me access to their site as well as ftp for trying this out, I would be most grateful.
In the meantime, could someone try the following: exchange this: $eventdateday = date("mj",$event[dateline_from]); with this: $eventdateday = vbdate("mj",$event[dateline_from],false,true,false,true); |
Ok I just tried that out... it seems to fix half of the problem. Now all-day-events are shown on the correct day, but if you click the link, it still goes to the day before.
So for example, before the fix an all-day August 14th event would appear on August 13th and link to August 13th, resulting in an error. Now it appears on August 14th on the mini calendar, but still links to the 13th, so there is still an error. For more information, here is August 2004 on my mini calendar. Original, unmodified install: *12th - Midnight to 9AM --Correct *14th - All-day --Incorrect, the 13th is highlighted/linked instead and the link points to the 13th *20th - All-day --Incorrect, the 19th is highlighted/linked instead and the link points to the 19th *21st (8am) to 22nd (9am) --Only the 21st is highlighted as having an activity, even tho the event extends over two days *29th - 8am - 11:30pm --Correct *30th - All-day --Incorrect, the 29th is highlighted/linked instead and the link points to the 29th Now w/ your fix: *12th - Midnight to 9AM --Correct *14th - All-day --The correct day is highlighted, but the link points to the 13th, resulting in an error *20th - All-day --The correct day is highlighted, but the link points to the 19th, resulting in an error *21st (8am) to 22nd (9am) --Only the 21st is highlighted as having an activity, even tho the event extends over two days *29th - 8am - 11:30pm --Correct *30th - All-day --The correct day is highlighted, but the link points to the 29th, resulting in an error |
Hi, Colin ... thanks for the hack!, which I got working on my forumhome ... but, of course, I wanted MORE, so I decided to try to make a second small calendar as well. Here's what I did:
First, I completed the hack for one calendar ... then: Made second (duplicate) template and named it small_calendar_bal. Duplicated cal.php and named it bal.php assigned it to: $calendarid = 2; Replaced all instances of $calendarbits with $balendarbits changed the last line of that file to: eval("\$smallcalendarbal .= \"".fetch_template("small_calendar_bal")."\";") ; Uploaded bal.php Called it from the template: $smallcalendarbal Added this in index.php: require_once('./global.php'); include ("cal.php"); include ("bal.php"); Both instances now link to the correct calendars. HOWEVER, entries made in either calendar show up as day links in both. While if incorrect, they link to the "no entry" error page ... it would be sweet if I could correct his one remaining problem. Any ideas? |
OK, to fix the wrong link problem, find:
$eventday= date("Y-n-j", $event[dateline_from]); replace with: $eventday= vbdate("Y-n-j", $event[dateline_from],false,true,false,true); Do this with all three instances of the find text. I'll upload an updated cal.php shortly. |
Great that you got it to wrok spence2!
Could you add an event on calendar 1 and an event on a different date in calendar 2? Then check which event is displayed (linked) on each of your three minicalendars. |
Works like a dream, thank you! Definitely going to be making good use of this... keep up the good work.
|
See the bottom part of my first post to see what's to do if you like/installed the hack ;)
[high]* Colin F is happy it's finally working![/high] |
Quote:
i.e. i've got a ranged event from August 14th to 15th, but only August 14th on the mini calendar has a link. I've been using your hack for the last few days, and I think that's the last bug. |
I also don't use ranged events on my calendar :)
But I'll look into it aswell when I get home this evening. |
Quote:
Thanks |
Quote:
If you don't get around to it I might give it a shot down the line. |
Can you try it with this file?
I did something for the ranged events... Eventpreview is kind of complicated. What should I do if there are 5 events? which one is the first? |
I'd say ignore the ordering... it's more of a nice small feature than anything that should be robust, in my opinion... so just grab the events so people can see what's going on.
As for the ranged events... very close to working. The one bug I have seems to be related to timezone offset. Since I'm PST (-8), any event 4pm or after is showing up for the next day instead. |
Any event that starts 4pm or after is showing up for the next day....
Can you check if this is only for ranged events or also for recurring events? If so, then it's most probably the utc field in the database... |
Here's an updated file, try this and tell me if it works please...
|
Hmm, that just seems to have pushed the threshold back an hour, to 5pm. The bug happens with any event that allows you to schedule a time.
Anytime that's 5pm or after appears for the next day. So if I have a single-day ranged event from 9pm-11pm on August 10th, the link will appear on August 11th. |
Quote:
|
Daylight Savings Time?
|
I don't see how it can be daylight savings time, as I "actually" didn't touch anything that has to do with that. Thanks for the input though...
Why dont you try changing the three occurences of $theday = date( to $theday = gmdate( I'll also look into changing the thing checking the date, if that doesn't solve the problem. |
Ok it has to be a time-zone bug. Because when you enter calendar event data it allows you to choose the timezone, so vbulletin must be doing some additional calculations based on the user's own timezone selection, and the timezone for which the event was added.
Pacific Time (for both event and user setting): August 14th 8am - 4:30pm ---works fine August 14th 8am - 5:00pm ---links the 15th as well |
meaning, we have the date going till the 15th.
So I'm assuming vB is actually reading it as: August 14th 4:00pm - August 15th 1:00am Is this *with* gmdate? |
Yep, that's exactly what it seems like it's doing, with gmdate. Quite weird.
I wish there were other people trying this out too so I didn't feel insane :o |
If this doesn't work, then I guess I'll have to redo a big part... oh well...
Thanks for helping me sort this out PUPSTAHS |
Is it possible to port this to a page outside of vB? For example, I have my main index at http://www.milwaukeenights.com/index.php and my forums are located in a sub domain at http://forums.milwaukeenights.com . I want to show the mini calendar on my index page outside of vB but some reason I am just getting a blank spot where the calendar should. Not even a db error message or anything, just an empty spot....
|
to put this minicalendar here http://www.elaborare.info/forum/vbul...splay.php?f=25 what i must modificate???
|
Hi, can you put some examples where to put the "$smallcalendar", where did you put it?
|
Hello Colin.... I have changed the size to 160 pixels and removed all of the padding... how can I fix the top to be on one line, my month looks like this
< November 2004 > where can I edit this to take care of it. |
You should be able to edit this in the template, I think the current width is 200, so just exchange that with whatever you want.
|
BUMP... cuz I edit the post right after I posted, but before your reply..... sorry
|
You'll have to use a smaller font size, as that's the problem. Having it on one line will just stretch the table, making it bigger than those 160 pixels you wanted.
|
All times are GMT. The time now is 06:04 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|