[TYPO3-ect] how to use printAs...() of tx_lib_phpTemplateEngine

Christian Welzel gawain at camlann.de
Thu Apr 26 14:21:22 CEST 2007


hi there!

i want to use a template with phpTemplateEngine and the method per action in
controller approach of lib/div and im running into some problems:

i fill my model with

while($row =$GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
  $entry = new tx_lib_object($row);
  $this->append($entry);
}

this works fine. my two test entries are filled into the model.
Now i want to use my view with is a subclass of tx_lib_phpTemplateEngine.
The PHP-File for the view gets loaded nicely and with a loop

<?php for($this->rewind(); $this->valid(); $this->next()) {
     $entry = $this->current();
?>
        <li>
<?php
    echo $entry->asDate('begin', '%d-%m-%Y');
    echo ' - ';
    $this->printAsDate('end', '%d-%m-%Y');
?>
        </li>
<?php } ?>

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?

-- 
MfG, Christian Welzel

  GPG-Key:     http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15


More information about the TYPO3-team-extension-coordination mailing list