News


.

Text Size



01.12.2006 - Age: 4 years

About the new marker functionality

Category: TYPO3 calendar

By: Mario Matzulla

A deeper look

Instead of creating all different kind of markers we now go ahead and search for markers inside the template. Now, knowing what markers we have to fill, we can create the according content. This new way of substituting the template markers offers a new possibility: module markers and variable markers.

Variable markers are markers many of you have been waiting for. They can be used in conjunction with a model template e.g. phpicalendar.tmpl, location.tmpl or organizer.tmpl.
Let me give you an example:

You want to extend the event with a new attibute. Before 0.14.0 you had to create a new event service and a new event model and overwrite the according functions. But now we store the complete row inside each model and when a new marker appears we try to map it to a db value. E.g. adding ###UID### in the phpicalendar.tmpl template will return the uid of the event. And to make it even better we packed it into a stdWrap: view.event.stdWrap_uid. This stdWrap will also be created dynamically depending on the marker name: view.{model}.stdWrap_{marker in lowercase}

But that is not enough :) - Adding custom values from the database leads to adding custom labels, which is also possible now: ###MYUID_LABEL###. Here we are using a keyword: _LABEL which will search in the locallang file for an according value: l_event_myuid. The structure is: l_{model}_{labelname in lowercase}.

A module marker is a marker starting with the keyword MODULE__ e.g. ###MODULE__TEST###. You should be able to add this marker in any template. If such a marker is found, cal will try to instanciate a service with that name: TEST and type: module. Have a look at ext_localconf.php inside cal, there is already an example service.
If a service is available it calls the start function and hands over an instance of itself: $module->start($this). It expects some html content in return to fill into the marker.

Module marker should make it a lot easier for you to develop new - undependend - functionalities which should be integrated into the calendar.


 

-top-