Order results based on site tree in hierarchical viewer

Alan Isaacson asked on May 13, 2016 15:53

I have been setting up a hierarchical viewer for a homepage that pulls all of its content from sub-pages. I have got the content appearing correctly for each different type of page. I would like the page content to appear in the order of the pages in the tree; eg Page 1, Page 2, Page 3. If the user were to then move the page order eg Page 3, Page 2, Page 1 that would then be how the content appears on the page.

Correct Answer

Brenden Kehren answered on May 13, 2016 16:09

To get the exact structure like in the content tree you need at least this in the Order by field: NodeOrder, NodeLevel. I typically do NodeOrder, NodeLevel, NodeName to alphabetize them. Using only NodeOrder will order them no matter what level (1, 2, 3, etc.) so you need to add the NodeLevel as well so they aren't ordered incorrectly.

4 votesVote for this answer Unmark Correct answer

Recent Answers


Anton Grekhovodov answered on May 13, 2016 16:00

Hi Alan,

You should insert NodeOrder value to 'ORDER BY expression' field

0 votesVote for this answer Mark as a Correct answer

Alan Isaacson answered on May 13, 2016 16:18

These both seem like correct answers as my pages only go to one level. Many thanks for the help. I have to clear the cache if I reset the order, is there a way to make that automatic upon re-order or just something I have to live with.

0 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on May 13, 2016 17:17

You can setup the cache dependency key: nodes|<site name>|<page type code name>|all (in lower case)

See more here

0 votesVote for this answer Mark as a Correct answer

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