[TYPO3] HTML template

Sander van Gelderen mail at sandervangelderen.nl
Fri Jul 13 17:22:09 CEST 2007


Hi Racco,

I think I understand your problem.

First have a good read of this: http://wiki.typo3.org/index.php/Extension_Development,_using_HTML-Templates
Especially pay attention to the part with title "Subparts Are useful for filling rows."

You will see that your SUB_TEMPLATE_ITEMS and SUB_TEMPLATE_ITEM should be nested, not separate.

Next, you will want to use a counter in your loop, and use the modulus-operator (%) to check if you have reached the desired
number of images.

HTH,

Sander


Rakowski Tomasz schreef:
> Hello!
> 
> I have the following problem:
> 
> I am creating ext that will use HTML templates.
> The basic role of this ext is to display the images in rows and you can 
> specify the number of pictures in the row (so in other words you can 
> specify the number of columns).
> I want to build it using tables (<tr> <td>).
> 
> I divided template into some parts.
> But the most crucial thing is the logic of this subpart stuff.
> How to create a template or write a code that would enable me after 
> reaching 3 fotos to start a new <tr> row?
> Because now I have sth like this:
> 
> <!-- ###SUB_TEMPLATE_ITEMS### begin -->
> 
> <table>
> 
> <tr>###ITEMS###</tr>
> 
> </table>
> 
> <!-- ###SUB_TEMPLATE_ITEMS### end -->
> 
> 
>      <!-- ###SUB_TEMPLATE_ITEM### begin -->
>     
>     <td >###FOTO###</td>
>     
>     
>     <!-- ###SUB_TEMPLATE_ITEM### end -->
> 
> 
> 
> and it is impossible.
> 
> My PHP code works like that:
> 
> 
> first funtion realisationsView() gets the template parts
> and calls listing fuction:
> $markerArray['ITEMS']=$this->listImages();
> 
> listImages() queries the DB and on every record it calls another 
> function that will get all data of that particular record:
> $tRows[] = $this->imageElement();
> 
> imageElement() substitutes the ###FOTO### marker
> $markerArray['FOTO'] = 'sth';
> and returns it back to parent function
> 
> return $this->cObj->substituteMarkerArray($this->rowTplImage, 
> $markerArray, '###|###', 0);
> 
> 
> I hope you understand my problem.
> I would like to check the number of records (in listImages) and than if 
> it's greater than some number start a new row <tr>.
> 
> 
> thx in advance for any ideas
> 
> racco


More information about the TYPO3-english mailing list