[TYPO3-mvc] Get childs
Dawid Pacholczyk
dpacholczyk at gmail.com
Fri Oct 22 09:10:43 CEST 2010
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 ?
Best regards,
Dawid "Fixus" Pacholczyk
2010/10/22 Dennis Ahrens <dennis.ahrens at googlemail.com>
> Hi Dawid,
>
>
> Dawid Pacholczyk wrote:
>
>> Hello List,
>>
>> I`m wondering about one thing. I have a model "BLOCK". Block is some
>> object
>> with content. Every block can have subblock, every subblock can have
>> subsubblock and go on.
>>
>>
>> Now. I can get childs using recurrence. BUT my question is. Does extabse
>> got
>> internal system to manage this ? For example we have
>> $this->someRepository->findAll(); Is there something similar for getting
>> childs ? Is there a way to use recurrence in fluid template ?
>>
>
> I have a similar model - a DocumentTemplateElement has a mm-relation to
> itself to set up a tree structure. I've solved the rendering by using a
> partial that looks like this:
>
> <f:if condition="{element}">
> <f:then>
> <ul>
> <f:for each="{element.elements}" as="ele">
> <f:render partial="DocumentTemplateElement"
> arguments="{element: ele}" />
> </f:for>
> </ul>
> </f:then>
> <f:else>
> Error - no element given
> </f:else>
> </f:if>
>
> You normally do not need a repository for fetching the childs. You access
> them through the root object. $subblocks = $myblock->getSubblocks();
>
> If you have to fetch them from repository, you may write a special query,
> that checks if the object is associated as uid_foreign in your mm-table. Or
> you add a depth property to your model, that you can ask via SQL.
>
> 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