[TYPO3-english] Problem with generating template

Loek Hilgersom hilgersom at xs4all.nl
Thu Jun 3 12:18:44 CEST 2010


Hi Dawid,

It looks like $templateName has the value 'SUBPART1' now, and that subpart 
includes the title, so it will be rendered for every record. If you change it to 
'SUBPART2' you should be alright.

Hth,
Loek

On 2010-06-03 11:36, Dawid Pacholczyk wrote:
> Hi List,
>   I have small problem in my ext.
>
> At the moment I have template like this
>
> <!-- ###SUBPART1### -->
> <div>
> <h1>Title</h1>
> <!-- ###SUBPART2### -->
> ###CONTENT###
> <!-- ###SUBPART2### -->
> </div>
> <!-- ###SUBPART1### -->
>
>
> The php code to generate this template:
> $templateCode = $this->cObj->fileResource($this->templateFile);
> $template = $this->cObj->getSubpart($templateCode, '###'.$templateName.'###');
> 		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
> 			$markerArray['###CONTENT###'] = $row['content'];
> 			$content .= $this->cObj->substituteMarkerArray($template, $markerArray);
> 		}
>
> The problem is ofc that the Title is generating every time in loop (to
> get more info I`ll say that this ext should provide list of records
> (###CONTENT###) with one title)
>
> And now. I`m guesing that I miss 1 more subpart in my template to
> display Title just one time and the records in loop. But I don` know
> how to write the code for it. Can you give me some info how to do it ?
>
> Best regards,
> Dawid Pacholczyk
>


More information about the TYPO3-english mailing list