[TYPO3-ect] how to use printAs...() of tx_lib_phpTemplateEngine
Elmar Hinz
elmar.DOT.hinz at team.MINUS.red.DOT.net
Thu Apr 26 15:41:17 CEST 2007
Am Thu, 26 Apr 2007 14:21:22 +0200 schrieb Christian Welzel:
>
> i get an output of two list elements. But how to access the data in the
> entries?
>
>> echo $entry->asDate('begin', '%d-%m-%Y');
> This does not work, because $entry is not of type tx_lib_phpTemplateEngine.
>
>> $this->printAsDate('end', '%d-%m-%Y');
> This does not work because printAsDate() seems not to accept an fieldname as
> first argument...
>
> So what is the correct convension for calling this methods?
>
Currently I am not so deep in it. As you observe your naked model data
have no view functions available. It's the job of the controller to bring
them together. There are many alternative ways to access model data by a
view. In lib/div the fundamental concept is, to chain SPL objects in the
controller.
See tx_efaq_controllers_common->_compose() in:
http://typo3.org/extensions/repository/view/efaq/0.1.7/info/controllers%252Fclass.tx_efaq_controllers_common.php/
In the loop there is a line:
$entry = new $entryClassName($this,$highlighted);
Here the model data is filled into view objects.
(var $entryListViewClassName = 'tx_lib_phpTemplateEngine';)
Mind: The $this parameter is the controller. It should always be provided
to give access to paramters and configuration. It can have first or second
position. Both does the same:
$entry = new $entryClassName($this,$highlighted);
$entry = new $entryClassName($highlighted, $this);
That is a very important extension to plain SPL objects.
Regards
Elmar
--
Fight the no_cache parameter:
http://t3flyers.wordpress.com/2007/04/06/a-quick-guide-to-proper-caching-with-tslib_pibase-episode-1/
http://t3flyers.wordpress.com/2007/04/06/a-quick-guide-to-proper-caching-with-tslib_pibase-episode-2/
More information about the TYPO3-team-extension-coordination
mailing list