[Typo3-german] Ext Templating - Mehrere getSubpart in Extenion
Andreas Kern
ady at gm.de
Wed Sep 7 11:44:38 CEST 2005
Hi liste, habe mal eine Frage, ich möchte meine Extension
Templatebasierend machen, ist ja auch soweit kein Problem.
Doch sobalt ich mehrere getSubparts habe komme ich nicht mehr klar.
Kann mir da jemand einen Gedankenanstoss geben ?
Hier mal ein Beispiel (was nicht funktioniert)
<?php
#...
$this->templateCode =
$this->cObj->fileResource($this->conf['templateFile']);
if ($this->templateCode=="") {
return
'<h3>'.$this->pi_getLL('templateNotFound').'</h3>'.$this->conf['templateFile'];
}
$markerArray=array();
$wrappedSubpartArray=array();
$this->listTemplateCode =
$this->cObj->fileResource($this->conf["templateFile"]);
$this->all = $this->cObj->getSubpart($this->listTemplateCode,
"###TEMPLATE_ALL###");
$this->row = $this->cObj->getSubpart($this->listTemplateCode,
"###TEMPLATE_ROW###");
$this->row2 = $this->cObj->getSubpart($this->listTemplateCode,
"###TEMPLATE_ROW2###");
$query = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','DB','','','');
$num = mysql_num_rows($query);
if($num>=1){
while($data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($query)){
$markerArray2['###MARKER_EINS###'] = $data['eins'];
$markerArray2['###MARKER_ZWEI###'] = $data['zwei'];
$query2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','DB2','uid =
'.$data['pid']);
$num = mysql_num_rows($query2);
if($num>=1){
while($data2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($query2)){
$markerArray['###UNTERMARKER_EINS###'] = $data2['untermarker_eins'];
$content .=
$this->cObj->substituteMarkerArrayCached($this->row2,$markerArray,array(),array());
}
}
}
$content .=
$this->cObj->substituteMarkerArrayCached($this->row,$markerArray,array(),array());
}
// Letztmalig den umhüllenden Teilbereich ersetzen
$content =
$this->cObj->substituteMarkerArrayCached($this->all,$markerArray,array(),array());
return $content;
#...
?>
<!--###TEMPLATE_ALL###-->
<table border="1" cellpadding="0" cellspacing="0">
<!--###TEMPLATE_ROW###-->
<tr>
<td><B>###MARKER_EINS###</B><br/>###MERKER_ZWEI###</td>
</tr>
<!--###TEMPLATE_ROW2###-->
<tr>
<td>- ###UNTERMARKER_EINS###</td>
</tr>
<!--###TEMPLATE_ROW2###-->
<!--###TEMPLATE_ROW###-->
</table>
<!--###TEMPLATE_ALL###-->
More information about the TYPO3-german
mailing list