Example of use:
in pi1/class.tx_yourext_pi1.php, method main():
$myData = array();
$myData[] = array('lastname' => 'Hader', 'firstname' => 'Oliver');
$myData[] = array('lastname' => 'Kamper', 'firstname' => 'Steffen');
$myData[] = array('lastname' => 'Baschny', 'firstname' => 'Ernesto');
$myData[] = array('lastname' => 'Perseguers', 'firstname' => 'Xavier');
$this->cObj->start($myData);
return $this->cObj->cObjGetSingle(
$this->conf['persons'],
$this->conf['persons.']
);
in res/template.html:
<html>
<head>
<title></title>
</head>
<body>
<table>
<thead>
<tr>
<th>###HEADER_FIRSTNAME###</th>
<th>###HEADER_LASTNAME###</th>
</tr>
</thead>
<tbody>
<tr>
<td>###FIRSTNAME###</td>
<td>###LASTNAME###</td>
</tr>
</tbody>
</table>
</body>
</html>
TypoScript:
plugin.tx_yourext_pi1.persons = TEMPLATE
plugin.tx_yourext_pi1.persons {
template = FILE
template.file = EXT:your_ext/res/template.html
workOnSubpart = PERSONS
marks {
HEADER_FIRSTNAME = TEXT
HEADER_FIRSTNAME.value = First Name
HEADER_LASTNAME = TEXT
HEADER_LASTNAME.value = Last Name
}
subparts.PERSON = LOOP
subparts.PERSON.renderObj = TEMPLATE
subparts.PERSON.renderObj.template < .template
subparts.PERSON.renderObj {
workOnSubpart = PERSON
marks {
FIRSTNAME = TEXT
FIRSTNAME.field = firstname
LASTNAME = TEXT
LASTNAME.field = lastname
}
}
}