This project is read-only.

Querying Content

Topics: General
Nov 1, 2011 at 12:00 PM

Hi there

Are there ways to query content in Orchard to create menu structures?

I currently use N2 CMS which provides a powerful way to create menus based on content structure, eg:

<%= N2.Web.Tree.From(N2.Find.StartPage, 2).Filters(new N2.Collections.NavigationFilter()).ClassProvider(i => i == Html.CurrentPage() || i == Html.CurrentPage().Parent ? "active" : "").ExcludeRoot(true)%>

and before I start testing Orchard I want to be sure this essential functionality is there.


Nov 1, 2011 at 12:55 PM

You can query content in many ways, but there's nothing exactly like that. Menus are custom built in the admin UI. There are also third party modules with a better menu UI.

There's also no concept of a page hierarchy built into Orchard - this is something I designed my Mechanics module for. It would be possible with Mechanics to define page parent/child relationships, and then build a menu automatically from them (automenus are a scenario I'll work towards for a future release).

Nov 1, 2011 at 7:34 PM

You should try Taxonomies.

This being said, the code you pasted is basically doing a data query from the view. That is horribly bad practice ;) We can do better :)