public:calcms:template_variables

Events

Variable Parameter Description Example
program program Mondlandung
series_name name of the series Berliner Runde
series_name_ical name of the series in ical text format Berliner Runde
title event title Er\x{f6}ffnungssendung
title_ical event title in ical text format Er\x{f6}ffnungssendung
content full event description
content_ical full event description in ical text format
html_content full event description
excerpt short description of the event
category xcategory, comma separated list Archiv
tag xtag, comma separated list Archiv
start event start datetime) 2008-07-21 18:00:00
end event end datetime 2008-07-22 01:00:00
start_date start date 2008-07-21
end_date date of event end 2008-07-21
start_date_name long format of event start date 21. Juni 2008
start_time_name long format of event start time 18:00
end_time_name long format of event end time 01:00
end_date_name long date format 22. Juni 2008
dtstart start datetime in iCalendar format 20080721T180000
dtend end datetime in iCalendar format 20080722T010000
week_of_year week of year 30
weekday_name name of the weekday Montag
weekday_short_name short name of the weekday Mo
weekday xnumbered weekday (monday=0) 0
time_of_day xtime span,
values:[night, morning, noon, afternoon, evening]
morning
is_first_of_day is the event first one of day 1
is_last_of_day is the event last one of day 1
rating rating of the event 0
created_at date when event was created,
see Google Calendar API
2009-04-13 14:16:59
modified_at datetime when event was modified last,
see Google Calendar API
2009-05-04 22:28:14
reference URL of event ID ,
see Google Calendar API
http://www.google.com/calendar/feeds/
mail@domain/private-123456/full/_1a2b3c
responsible name of responsible Mike Manager
event_id xinternal event id in database 7399
url called URL /calcms/agenda.cgi?p=7399
visibility see Google Calendar API 0
status see Google Calendar API confirmed
modified_at date, when the event was synchronized last time 2009-09-01 14:00
created_at date, when the event was created at calcms DB 2009-09-01 14:00

Example:

<TMPL_LOOP events>
	<TMPL_VAR start_date_name />, <TMPL_VAR start_time_name /> Uhr
	<h1>   <TMPL_VAR title /> </h1>
	<div > <TMPL_VAR content /> </div>
</TMPL_LOOP>

Event Category

Variable Description Example
name name of category Archive
sum number of matching category entries 12

Example:

<TMPL_LOOP categories>
	Category <TMPL_VAR name /> : <TMPL_VAR sum /> Hits <br />
</TMPL_LOOP>

Event tags

Variable Description Example
name name of tag Archive
sum number of matching tag entries 12

Example:

<TMPL_LOOP tags>
	Tag <TMPL_VAR tag /> : <TMPL_VAR sum /> Hits <br />
</TMPL_LOOP>

Calendar

Following variables can be used at Calendar Widget:

Parameters

Parameter Description
date date
time time
from_date start date, is set to config date/start_date if it is before project start
till_date end date, is set to config date/end_date if it is after project end

Results

Variable Description Example
week_and_days template loop, a list of week and it's days
weeks template loop containing week []
days template loop containing days []
weekdays template loop containing weeks weekdays []
previous_month date of previous month 2008-06-01
next_month date of next month 2008-08-01
start_date selected start date 2008-07-21
start_year selected start year 2008
start_month selected start month 07
start_month_name selected month name Juli
agenda_url name of the widget agenda.cgi
calendar_url URL of the calendar widget,
defined at configuration_file
/agenda/kalender/

Example:

<a href="<TMPL_VAR calendar_url>/<TMPL_VAR previous_month />" > &lt; previous month </a> <br />
<a href="<TMPL_VAR calendar_url>/<TMPL_VAR next_month     />" > &gt; next month     </a> <br />

week_and_days

Variable Parameter Description Example
weeks template loop containing week
days template loop containing days

weekdays

Variable Parameter Description Example
start_month_name selected month name Juli
start_date selected start date 2008-07-21
end_date selected end date 2008-08-21

week

Variable Parameter Description Example
date xdate
from_date xcurrent date start filter 2008-07-21
till_date xcurrent date stop filter 2008-07-27
week_year year of the week 2008
week_month month of the week 07
week_of_year week of year 30
week_start first day of week 21
week_end last day of week 27
description description of the week label Woche anzeigen
cell_type html element th
class html class attribute week_1
date_range_long label for weeks day span 21.07. - 27.07.
date_range_short short label for weeks day span 21.-27.
date_range_parameters selected parameters from_date=2008-07-21&till_date=2008-07-27
calendar_url relative URL to calendar widget
defined at configuration_file
/calcms/calendar.cgi
agenda_url relative url to agenda widget
defined at configuration_file
agenda.cgi
template name of the current template overview

Example:

<TMPL_LOOP weeks>
	Week:<TMPL_VAR label_week /> <br />
</TMPL_LOOP>

days

Variable Description Example
weekday_short_name short name of the weekday Mo
date date of the day 2008-07-21
date_parameter parameters to select the day date=2008-07-21
year year of the day 2008
month month of the day 07
day_month day and month 21. 07.
day day of the month 21
weekday weekday number, starting with monday=1,
values: [0,1,2,3,4,5,6]
1
weekday_name full name of the weekday Montag
is_day is it a day or a week label 1
calendar_url relative URL to the calendar widget
defined at configuration_file
/calcms/calendar.cgi
agenda_url relative URL of the agenda widget
defined at configuration_file
agenda.cgi
template name of the current template overview
description description of the day field 2008-07-21 anzeigen
cell_type html element span
class html class attribute week_1

Example:

<TMPL_LOOP days>
	Week:<TMPL_VAR label_day /> <br />
</TMPL_LOOP>

Example - basic template for a full calendar:

<table>
<!-- weekday row -->
<tr>
<TMPL_LOOP NAME=weekdays>
	<!-- weekday cell -->
	<th>
		<a 	href="<TMPL_VAR agenda_url>?from_date=<TMPL_VAR start_date>&till_date=<TMPL_VAR end_date>&weekday=<TMPL_VAR weekday>" >
			<TMPL_VAR "weekday_short_name">
		</a>
	</th>
</TMPL_LOOP>
</tr>

<!-- week rows -->
<TMPL_LOOP NAME=weeks_and_days>
<tr>
	<!-- week number cell -->
	<TMPL_LOOP NAME=week>
	<th class="<TMPL_VAR class>">
		<a 	href="<TMPL_VAR agenda_url>?<TMPL_VAR date_range_parameters>" >
			<TMPL_VAR week_of_year>
		</a>
	</th>
	</TMPL_LOOP>

	<!-- day cell -->
	<TMPL_LOOP NAME=days>
	<td class="<TMPL_VAR class>">
		<TMPL_IF is_day>
			<a 	href="<TMPL_VAR agenda_url>?<TMPL_VAR date_parameter>" >
				<TMPL_VAR day>
			</a>
		</TMPL_IF>
	</td>
	</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>

Comments

Parameters

event_start
event_id
limit
type tree or list

Variables

comments
comment_count
one_result
event_id
event_start
comments_url
server_cache
use_client_cache
template

Comments

Variable Description Example
id
parent_id
title
content
author
email
ip
event_start
event_id
event
lock_status
news_status

Events

Variable Description Example
comment_count

Agenda

Following variables can be used at Agenda Widget:

Variable Parameter Description Example
events template loop containing all selected events []
tags xtemplate loop containing all available tags []
categories xtemplate loop containing all available categories []
date xselected date, yyyy-mm-dd or [today, tomorrow, yesterday] 2008-07-21
from_date xdate start filter, yyyy-mm-dd or [today, tomorrow, yesterday] 2008-07-21
till_date xdate stop filter, yyyy-mm-dd or [today, tomorrow, yesterday] 2008-07-22
time xselected time, hh:mm or [now] 18:00
time_of_day xtime span, predefined at configuration_file,
values: [night, morning, noon, afternoon, evening]
noon
weekday xnumber of day of week, starting with monday=1,
values: [0,1,2,3,4,5,6]
0
event_id xinternal database id of the event,
for synchronization use reference instead
7399
category xcategory Archiv
tag xtag
template xHTML template to be used overview
search xselected search fields Berlin
limit xlimit number of results, e.g. for current playlist 5
event_count number of results 17
agenda_url URL of agenda widget,
defined at configuration_file
/calcms/agenda.cgi
modified_at date, when the agenda was updated the last time (set to current time) 2009-09-01 14:00

Example:

Hits: <TMPL_VAR event_count /> <br />

Common

To build web links between controllers following variables can be used.

The following variables are replaced by the names of the configured controllers or usecases. They can be used to build web links between controllers.

controller_broadcast
controller_broadcasts
controller_calendar
controller_comments
controller_domain
controller_feed
controller_ical

Example: Output a list of dates and link them to event view of this day.

<TMPL_LOOP date>
  <a href="/calendar/<TMPL_VAR controller_broadcast>/<TMPL_VAR date>/" >
    <TMPL_VAR date/>
  </a>
</TMPL_LOOP>

Debugging

To enable debugging output

available at all widgets:

Variable Parameter value Description Example
debug x is set to '1' if debugging is enabled 1
debug cache_files show mapping from url to cache file names
debug template show available template variables and their values
debug sql sql-request
debug db_results results from database
debug final_results modified results from database
debug day_results available template variables and their values
debug year selected calendar: years, months and days

References

HTML::Template language

  • HTML::Template defines variable names that are replaced by the current attribute value of the event.
  • output scalar values like
     <TMPL_VAR variable_name /> 
  • <html><a name=„template_loop“/></html>lists and nested result values can be used by defining loops
<TMPL_LOOP loop_name>
  <TMPL_VAR variable_name />
</TMPL_LOOP> 

Template should start by setting document specific HTTP Content-type MIME type

Example HTML

Content-type:text/html; charset=UTF-8;

<html>
	<body>
		<TMPL_LOOP events>
			...
		</TMPL_LOOP>
	</body>
</html>

Example ICS

Content-type:text/Calendar;
Content-Disposition: attachment; filename="herbstradio.ics"

BEGIN:VCALENDAR
...
END:VCALENDAR

Additional HTTP header fields may be inserted.


Impressum Datenschutz