[TYPO3-dev] Problem with subpart in subpart in subpart

Brian Bendtsen nightowl at galnet.dk
Fri Dec 7 13:27:06 CET 2007


Hi

Im having some problems with substituting an "advanced" html template

It looks like this:

<h3>TEMPLATE</h3>
<em>This is an example template for all combined markers</em>
<!-- ###TEMPLATE### begin -->
  <ul>
   <!-- ###KATEGORIER### -->
    <!-- ###KATEGORIER-ITEM### -->
     <li>###KATEGORI###</li>
	  <ul>
	  <!-- ###EMNER### -->
	   <!-- ###EMNER-ITEM### -->
	   <li>###EMNE###</li>
	   <!-- ###EMNER-ITEM### -->
	  <!-- ###EMNER### -->
	  </ul> 
    <!-- ###KATEGORIER-ITEM### -->
   <!-- ###KATEGORIER### -->
 </ul>  
<!-- ###TEMPLATE### end --> 

And my code looks like this:

function Navigation($content,$conf) {
		$this->conf=$conf;		// Setting the TypoScript passed to this function in $this->conf
		$lConf = $this->conf['navigation.'];	// Local settings for the listView function
		$marker = array();		
		# Get the template
		$this->templateCode = $this->cObj->fileResource($conf['templateFile']);
 		
		# Get the parts out of the template
		$template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
		$template['kategorier'] = $this->cObj->getSubpart($template['total'],'###KATEGORIER-ITEM###');
		$template['emner'] = $this->cObj->getSubpart($template['kategorier'],'###EMNER-ITEM###');

		# create the content by replacing the marker in the template
		$result = $GLOBALS["TYPO3_DB"]->exec_SELECTquery("*", "tx_coolreferencer_categories", "hidden = 0 AND deleted = 0");
		while($row = mysql_fetch_row($result)) {
		 $marker["###KATEGORI###"] = $row[7];
		 $content_kategorier .= $this->cObj->substituteMarkerArrayCached($template['kategorier'], $marker);
		 $resultS = $GLOBALS["TYPO3_DB"]->exec_SELECTquery("*", "tx_coolreferencer_subjects", "hidden = 0 AND deleted = 0 AND category='".$row[0]."'");
		 $content_emner = "";
		 while($rowS = mysql_fetch_row($resultS)) {
		  $markerS["###EMNE###"] = $rowS[7];
		  $content_emner .= $this->cObj->substituteMarkerArrayCached($template['emner'], $markerS);
		 }
		 $subpartArrayS['###EMNER###'] = $content_emner;
		 $content_kategorier .= $this->cObj->substituteMarkerArrayCached($template['kategorier'],array(),$subpartArrayS);
		}
		$subpartArray['###KATEGORIER##'] = $content_kategorier;
		
		$content = $this->cObj->substituteMarkerArrayCached($template['total'],array(),$subpartArray);
	 return $content;  
	}

This is what I get:

Web 
- ###EMNE### 
###KATEGORI### 
- Typo3 
- Shopløsninger 
IT 
- ###EMNE### 
###KATEGORI### 
- Netværksløsninger 
- Service 
- Hosting 

This is what I want:

Web 
- Typo3 
- Shopløsninger 
IT 
- Netværksløsninger 
- Service 
- Hosting 

Hope you can help

/Brian




More information about the TYPO3-dev mailing list