PDA

View Full Version : Mini Calendar


Colin F
07-06-2004, 10:00 PM
Mini Calendar

THIS HAS MOVED OUT OF BETA. SEE THE NEW THREAD HERE: https://vborg.vbsupport.ru/showthread.php?t=68117


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 attachments

screenshot1.jpg (https://vborg.vbsupport.ru/attachment.php?attachmentid=19573&stc=1)
screenshot2.jpg (https://vborg.vbsupport.ru/attachment.php?attachmentid=19574&stc=1)

Instructions:

Upload cal.php (attachment (https://vborg.vbsupport.ru/attachment.php?attachmentid=19575&stc=1)) to your forum home directory
Make a new template with the name small_calendar and insert the contents of template.txt (attachment (https://vborg.vbsupport.ru/attachment.php?attachmentid=19576&stc=1)) into it
Decide if you want to have your mini calendar on specific pages or on all your pages

If you decide to have the mini calendar on all your pages (for example in a sidebar) edit your phpinclude_start template and add include ("cal.php"); to the end of it.
If you only want the mini calendar on specific pages, open the php file that makes that page and under require_once('./global.php'); add include ("cal.php");

edit the template that shows the area in which you want to insert your mini calendar and add $smallcalendar to the exact spot where your mini calendar should be shown.

Colin F
07-07-2004, 09:36 AM
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:
$dayname_su="<td class=\"thead\">Su</td>";
$dayname_mo="<td class=\"thead\">Mo</td>";
$dayname_tu="<td class=\"thead\">Di</td>";
$dayname_we="<td class=\"thead\">Mi</td>";
$dayname_th="<td class=\"thead\">Do</td>";
$dayname_fr="<td class=\"thead\">Fr</td>";
$dayname_sa="<td class=\"thead\">Sa</td>";
French:
$dayname_su="<td class=\"thead\">Di</td>";
$dayname_mo="<td class=\"thead\">Lu</td>";
$dayname_tu="<td class=\"thead\">Ma</td>";
$dayname_we="<td class=\"thead\">Me</td>";
$dayname_th="<td class=\"thead\">Je</td>";
$dayname_fr="<td class=\"thead\">Ve</td>";
$dayname_sa="<td class=\"thead\">Sa</td>";
How can I have it use my other calendar?
If you have more than one calendar and would like mini calendar to pull the events from a different calendar, do the following:
[list]
Go to yourforums.com/pathtoyourforum/calendar.php?s=&month=6&year=2004&do=&c=1
Pick the calendar you want to use as the base for mini calendar from the Calendar Jump box on the bottom right.
Now look in your adressbar. The adress should be something like
yourforums.com/pathtoyourforum/calendar.php?s=&month=6&year=2004&do=&c=1Look for the c variable (marked red above) and write that down or remember that or whatever
Edit cal.php. Change the variable $calendarid on line 5 to the value of that c variable you picked out of the adress.
save / reupload

sabret00the
07-07-2004, 03:51 PM
nice work, i wanted something like this to go in my journal :)

Stan Melony
07-16-2004, 03:24 PM
I have problems understanding the instructions.

how can i make a template? where will i have to put it?

upnorth
07-16-2004, 08:07 PM
Any idea how I can get this working on a non-vB page? Would like to display this on my home page.

As well was wondering how hard it would be to convert this to a script that would display (again on a non-vB page) the events just for the current day?

I had both these when I was still on vB version 2.3.2 and it was a great way to show a canlendar and the current event on my home page but since I upgraded I'm not sure how to get this functionaliyt back?

Colin F
07-19-2004, 07:52 AM
well you've got to include cal.php for sure, so have
include ('./cal.php');
near the top of that file. You might have to change that a bit if you're in a different folder than your vB installation.
The template still goes into your templates and will be called anyway.
And then write $smallcalendar where you want the calendar to be.
I think it should actually work...

upnorth
07-19-2004, 06:45 PM
Took your code and made a few changes and thinks its wiorking for me. See the attached file. I pull this into my home page using an ifame tag.

One thing thats happening that I'm not sure why is when I add a new event to my calendar it shows up in the vB forum calendar on the proper day but on the mini calendar one day early? any events that were in my forum before I updated to 3.0.3 show up on the proper day in the mini caneldar its just the new ones that are off by one day...any ideas?

Colin F
07-24-2004, 07:43 AM
Hi upnorth

It seems what you did is simply include the template in the file :)

Do you have someplace I can see this problem? I can't get it to work here...

upnorth
07-26-2004, 07:44 PM
unfortunately I'm hosting behind a corp firewall.

Did you try running the code as is? Belive this page needs to be in the forums root to work so that it can find the following.

<?php
require_once('./global.php')
?>

which needs to be at the beginning of your html page.

upnorth
07-27-2004, 01:57 PM
Hey Colin did you have any luck with getting my file to run? Seems that all new events are showing up on my small calendar one day ahead of when they should. The main vB calendar is correct but say an event that shows on the vB calendar for tomorrow shows up on the mini calendar today. As well when you select the link on the mini calendar it dosn't pull up the event. I just get "there are no events to display". (I assume because of a date problem ...maybe the same one that has it off by one.) Any help would be appretiated. I'm currently at a loss and if I can't fix this I'll need to pull it from my site which I realy don't want to do as this is a cool hack

Colin F
07-27-2004, 02:07 PM
Sorry I didn't get back to you sooner.

I uploaded your file to my site, but (unfortunatelly) everything worked. The events are on the right day and the links work...

I'm thinking it has something to do with your timezone. What timezone are you in?

upnorth
07-27-2004, 04:58 PM
Time zone that the forum is set on is (GMT –7:00) Mountain Time (US & Canada)

I took a look at the “event” table and it looks like data fields are filled in differently from the old events that were put in during version 2.3.2 and any new events that were put in after the upgrade. The differences are as follows.

Older events the “dateline_from” and “dateline_to” fields are filled in and 0 is in the “dateline” field. For the new events “dateline_from” is filled in and “dateline_to” is empty and “dateline” is filled in. Example can be found below.

Event / dateline_from / dateline_to / dateline
Old1 / 1090497600 / 1090501200 / empty
New1 / 1090972800 / 0 / 1090607909

Does this help at all? Any ideas?

Colin F
07-27-2004, 05:37 PM
Ok, from the new one I know that dateline is when the event was entered. dateline_from is when it started.

On your old example, the dateline isn't filled in yet (I assume that's new) and the dateline_from and dateline_to are an hour apart.

You might try changing the date() functions to vbdate(), but I'm not sure if that would help :(

uReside.com
07-27-2004, 05:46 PM
Will this work for having a different calender for each subforum? Can you have it automatically add the calendar when you add a new sub forum? Because i want a calender for each sub forum but i'm planning on having around 5000 sub forums :(

Colin F
07-27-2004, 06:13 PM
no, there's nothing in it to make calendars. But you can have different calendars

upnorth
07-27-2004, 07:01 PM
which date() function are you reffering to?

Colin F
07-27-2004, 07:31 PM
all of them actually :)

upnorth
07-27-2004, 08:42 PM
sorry for all the questions as I just started codeing and am very green behind the ears.

Do you mean I should try changeing like the following

$year=date("Y");
to
$year=vbdate("Y");

and

$dayname1 = vbdate('w',mktime(0,0,0,$month,1,$year));
to
$dayname1 = vbdate('w',mktime(0,0,0,$month,1,$year));

for example?

Colin F
07-27-2004, 08:56 PM
yes.

But it's just a guess, because I'm not sure if vbdate has something to work around the timezones. It won't break anything for sure (well, pretty sure :))