Documentation
iCal view
Table of Contents ▼
Presentation
The iCal view allows you to send feeds in iCalendar format, used to transmit events to add to a calendar.
Usage
To use the iCal view, you must define the use of this view. In addition to this, you must assign a template variable named ical, which is an associative array with the following keys:
- name: (optionel) Name of the calendar.
- description: (optional) Description of the calendar.
-
events: (mandatory) List of calendar events. Each element of the list must be
an associative array with the following keys:
- name: (mandatory) Name of the event.
- description: (optional) Description of the event.
- html: (optional) Description of the event in HTML format.
- date: (optional) Date of the event in 'YYYY-MM-DD' format (if this key is not defined, the dateStart and dateEnd keys must be defined).
- dateStart: (optional) Start date of the event in the 'YYYY-MM-DD hh: mm: ssZ' format or 'YYYY-MM-DD hh: mm: ss + hh: mm' format (if this key is not not defined, the date key must be defined).
- dateEnd: (optional) End date of the event in the 'YYYY-MM-DD hh: mm: ssZ' format or 'YYYY-MM-DD hh: mm: ss + hh: mm' (if this key is not not defined, the date key must be defined).
- uid: (optional) Unique identifier of the event (recommended; otherwise generates a random identifier).
- dateCreation: (optional) Creation date of the event in 'YYYY-MM-DD hh: mm: ssZ' format or 'YYYY-MM-DD hh: mm: ss + hh: mm' format.
- organizerName: (optional) Name of the organizer of the event.
- organizerEmail: (optional) Email address of the event organizer.
Here is an example of sending data in RSS format:
class ApiController extends \Temma\Web\Controller {
public function getEventss() {
$this['ical'] = [
'name' => 'My agenda',
'events' => [
[
'name' => 'Dentist',
'dateStart' => '2025-04-07 15:30:00+01:00',
'dateEnd' => '2025-04-07 16:25:00+01:00',
'uid' => 'evt-01',
],
];
$this->_view('\Temma\Views\ICal');
}
}
- Lines 3 to 12: Definition of the data that will be transmitted to the view.
- Line 13: We specify that the view to use for the outgoing data is the iCal view (and not the usual Smarty view).
Note: The iCal view obviously does not need any templates, since it is the PHP data that is directly serialized.
The received data will look like this:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Temma//ICalView 1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-TIMEZONE:UTC
X-WR-CALNAME:My agenda
BEGIN:VEVENT
UID:evt-01
DTSTART:20250407T143000Z
DTEND:20250407T152500Z
SUMMARY:Dentist
TRANSP:TRANSPARENT
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
Previous: | INI view |
Next: | Dependency injection |
Table of Contents
- Migration : How to upgrade from Temma 1.x to version 2
- Installation : Download Temma and install it to start your web project
- Configuration : All the configuration directives of the etc/temma.json file and the optional environment variables
- External libraries : How to use external function libraries
- Routing : Temma's default routing system, and advanced routing
- Log : Use of the log system, management by criticality levels
- Controllers : Essential parts of your web application
- Views : Smarty templates or JSON/CSV/RSS/iCal/INI exports
- Dependency injection : The backbone of your application developments
- Sessions : Extension of user sessions managed by PHP
- Data sources : Unified data access management
- Model : How to use DAOs to access databases
- Execution flow : How to manage the execution flow, between plugins and the controller
- Plugins : How to use plugins, and create your own plugins to modularize your code
- Attributes : How to filter access to controllers and actions
- Tests : To write automated integration tests.
- Command-line interface : To create executable scripts on the command line, automatically initialized by Temma
- Helpers : Items offered by Temma to help you in various circumstances