[TYPO3] subpart in a template
Christian Hensel
christian.hensel at gmx.net
Sat Jun 16 23:31:57 CEST 2007
Hi List, just following the instructions on(
http://wiki.typo3.org/index.php/Extension_Development,_using_HTML-Templates
) a question appeared:
i marked a section with //frage, because im not quite sure, if i have to do
it like that there? Should i define $res differently?
regards
Christian
Ext. Code:
/Start//
$content = '';
# Get the template
$this->templateCode =
$this->cObj->fileResource('typo3conf/ext/cevi_user_enabler/enable.html');
$template['total'] =
$this->cObj->getSubpart($this->templateCode,'###ENABLE###');
$template['item'] =
$this->cObj->getSubpart($this->templateCode,'###ITEM###');
//frage
$query = "SELECT * FROM be_users";
$res = mysql(TYPO3_db,$query);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
# Build content from template
$markerArray['###name###'] = $row['realName'];
$content_item .=
$this->cObj->substituteMarkerArrayCached($template['item'], $markerArray);
} */
$subpartArray['###USER###'] = $content_item;
$content = $this->cObj->substituteMarkerArrayCached($template['total'],
array(), $subpartArray);
*/
return $content;
Template:
<!-- ###ENABLE### begin -->
<div class="bodytext">
<table border="0">
<tr>
<td> </td>
<td>Benutzername:</td>
<td>Name:</td>
<td>E-Mail Adresse:</td>
<td> </td>
</tr>
<!-- ###USER### -->
<!-- ###ITEM### -->
<tr>
<td>###icon###</td>
<td>###username###</td>
<td>###name###</td>
<td>###e-mail###</td>
<td>###edit###</td>
</tr>
<!-- ###ITEM### -->
<!-- ###USER### -->
</table></div>
<!-- ###ENABLE### end -->
More information about the TYPO3-english
mailing list