Forums: Calendar v2: How to add a new field to calendar monthly page - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Calendar v2: How to add a new field to calendar monthly page

#1 User is online   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16270
  • Joined: 03-February 03
  • Gender:Male

Posted 16 June 2015 - 06:45 PM

This tutorial applies to Calendar v2. Before following steps in this tutorial make sure you have downloaded the latest version of Calendar template.

We'll show how to display an icon next to each event on Monthly view.

Posted Image

Here is how this can be done.

1. Add a new field to calcalendar table. In our example that will be img field that stores icon URL.

2. Modify SQL query of all views where this field needs to appear adding this new field to the list.

FROM calcalendar

3. On 'Choose fields' screen choose page where new field needs to appear i.e. Add/Edit/View pages of certain views.

4. Now proceed to <project folder>\Business\Calendar\source\include folder and open calendar_functions.php file in any text editor.

You will need to modify function function calendar_getEventHTML adding text in bold.


$strtmp = $event[calendarGetSetting("calendarSubject")];
if (strlen(trim($strtmp))==0 )
if (strlen($strtmp)>$_SESSION["calendar_SubjectLength"])
$strtmp = substr($strtmp,0,$_SESSION["calendar_SubjectLength"])."...";
if ($event["img"])
$strtmp .= " <img height=16 width=16 src='".$event["url"]."'>";

Best regards,
Sergey Kornilov

#2 User is offline   Sergej 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 111
  • Joined: 09-December 11

Posted 22 September 2015 - 04:30 PM

i had an issue in phprunner 8.1 and Calendar template v2.0 - i could not display values of two fields in the monthly or weekly pages - only the value of the last field was on display - so i slightly modified calendar functions.php
like this
$strtmp1 = $event[calendarGetSetting("calendarSubject")];
if (strlen(trim($strtmp1))==0 )
if (strlen($strtmp1)>$_SESSION["calendar_SubjectLength"])
$strtmp1 = substr($strtmp1,0,$_SESSION["calendar_SubjectLength"])."...";
$strtmp2 = $event[calendarGetSetting("calendarDescription")];
if (strlen(trim($strtmp2))==0 )
if (strlen($strtmp2)>$_SESSION["calendar_DescriptionLength"])
$strtmp2 = substr($strtmp2,0,$_SESSION["calendar_DescriptionLength"])."...";


the new variables were used $strtemp1 & $strtemp2 while previously only $strtemp was enough.
i put the values of the Subject and Description to session variables
and later to the original $strtmp variable added values of $strtemp2 and one session variable though i could use both sesion variables - and have displayed in the calendar subject and description field values - while previously was only one or the other displayed depending which was last listed in this section of the code.
Hope this will help someone solve the similar problem.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users