pls help to sort out this issue

ramesh perera asked on October 19, 2015 16:49

Hi!

Home about -test1 --t1 ---t2 -test2 -test3 contact photos

(home,abount,contact and photos are in same level) (test1, test2,test3 are in same level)

suppose t1 and t2 are pages and it has repeater on both pages. so how can i set the path of the repater to list all the items under "about" page? cant i use following line? please help to to find a solution

{% if(DocumentContext.CurrentDocument.NodeLevel == 3)?DocumentContext.CurrentDocument.Parent.NodeAliasPath : DocumentContext.CurrentDocumentParent.NodeAliasPath #%}/%

Thank you Ramesh

Recent Answers


Brenden Kehren answered on October 19, 2015 17:48

You can use Path Expressions along with the macros. I'd suggest using

{% if(CurrentDocument.Children.Count > 0){CurrentDocument.NodeAliasPath + "%"}else{"/{0}/%"} #%}

1 votesVote for this answer Mark as a Correct answer

Laura Frese answered on October 19, 2015 19:36

Hi Ramesh. You should be able to specify the path to /about/% in the repeater. The % is a wild card that tells the repeater to get all the pages under the about page. You can also use formatting strings. for example /about/{0} will only get the first level of pages under the about page. More info here

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 19, 2015 22:47

@Laura, using /about/{0} will return /about/about and not /about/test1 or /about/test2.

I believe the correct syntax is /about/{1}/% or if you want a fully dynamic page template you can use /{0}/{1}/%

2 votesVote for this answer Mark as a Correct answer

ramesh perera answered on October 20, 2015 08:56

Hi Laura! Thanks for your reply

0 votesVote for this answer Mark as a Correct answer

ramesh perera answered on October 20, 2015 08:58

Hi Brenden! thanks for your replly. i used your if condition and i fixed it. thanks. i set the path as follows

{% if(DocumentContext.CurrentDocument.NodeLevel == 3){DocumentContext.CurrentDocument.Parent.Parent.NodeAliasPath + "/%"}else{DocumentContext.CurrentDocumentParent.NodeAliasPath + "/%"} #%}

thanks again

ramesh

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.