[TYPO3-mvc] Get childs

Dawid Pacholczyk dpacholczyk at gmail.com
Fri Oct 22 10:54:50 CEST 2010


It doesn`t work...or should I say I`m doing something wrong.

One more time.

I have an object./model Block

Block is in relation ONE-TO-MANY with itself

So I have a tree like in mail before

Now I want to display this tree.

I did something like that

/**
 * findByArticle($article) giver me MAIN blocks (level 1) witch are
connected with article
*//
$this->view->assign('blocks',
$this->blockRepository->findByArticle($article));

I`ve debbuged the array that it retturned. I have tree in there. Now I want
to display
So I did like this.

<f:for each="{blocks.block}" as="bl">
    <div class="bodytext">
        <f:render partial="DocumentTemplateElement" arguments="{blocks.bl}"
/>
    </div>
</f:for>

What am I doing wrong ?

2010/10/22 Dennis Ahrens <dennis.ahrens at googlemail.com>

> Hi Dawid,
>
> Dawid Pacholczyk wrote:
>
>> Thank you for your reply !
>>
>> <f:for each="{element.elements}" as="ele">
>>                       <f:render partial="DocumentTemplateElement"
>> arguments="{element: ele}" />
>>               </f:for>
>>
>> I`m not sure that I`m getting it. With this loop you`re iterating every
>> child of the root ?
>>
>> For example I have structure like this
>>
>> - Block  1
>>  - Block 1_1
>>  - Block 1_2
>>  - Block 1_2_1
>>    Block 1_2_1_1
>> - Block 2
>>  - Block 2_1
>>
>> I will get all of them ?
>>
>
> You call the partial from your template with:
> <f:render partial="DocumentTemplateElement" arguments="{element:
> myDocumentTemplateElement}" />
>
> And the partial calls itself recursively for the childs.
>
>
> regards
> Dennis
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>



-- 
Dawid Pacholczyk
tel: 502-054-334
gg: 5564051
skype: dpacholczyk
http://typo3blog.pl (only polish version at the moment)


More information about the TYPO3-project-typo3v4mvc mailing list