Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Recursion Problem View modes: 
User avatar
Member
Member
Christian Stampfli - 4/26/2011 6:53:59 AM
   
Recursion Problem
Hi there

In one of our webpages we want to use a recursive repeater - the problem is that the repeater should go "up" and not - like the default behaviour - down...

Example:


/ (Root)
- Image1.jpg
- Image2.jpg
/--- Mainpage1
| | - Image3.jpg
| | - Image4.jpg
| --- Subpage1
| | - Image5.jpg
|--- Mainpage2
| | - Image6.jpg
| --- Subpage2

So if we are on Mainpage1 there should be the following items in our repeater:
Image4, Image3, Image2, Image1

If we are on Subpage1 there should be the following items in our repeater:
Image5, Image4, Image3, Image2, Image1

And if we are on Mainpage 2 there should only be the following items in our repeater:
Image6, Image2, Image1

My first idea was to do this in a transformation which uses another repeater. But the problem is, if I'm on "subpage2" there is no inital-image so the transformation is not executed.

The second idea is to do this with a custom data source / repeater with custom query - but I think this would be very difficult to do because of the way the documents are stored.

So... as far as I can see there is no "normal" way to do this. Has anyone done this before or can someone give me some hints how to do this?

Thanks
Christian

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/26/2011 9:11:52 AM
   
RE:Recursion Problem
Hello


You could use the standard Repeater with Path: /% and set up the Where condition. For example:

(NodeLevel = 1) OR (NodeParentID = {%NodeID%}) OR (NodeParentID = {%NodeParentID%})

Please set up the Document types property to images only. More information about Macros is in our Developer's Guide.

The other possibility is using two (or more) repeaters with a Where condition about NodeLevel. You could use the special Path expressions.


Best regards,
Helena Grulichova

User avatar
Member
Member
Christian Stampfli - 4/26/2011 9:57:22 AM
   
RE:Recursion Problem
Hi Helena

Thanks for your fast reply. It works perfect!

Regards
Christian