This project is read-only.

Link pages(aka ContentItems) by URL

Feb 8, 2009 at 3:58 PM
Hi. I have some classes, which superclasses are from package N2.Templates.Items. And i have templates of my classes. I want to set properties of, for example, Login server control, such as CreateUserUrl, DestinationPageUrl and same, in Page_Load method of my template. I find UrlParser class in core of N2. And there is this method:
Factory.UrlParser.BuildUrl(...) , where ... - instance of ContentItem.
How I can receive instance of objects of my classes derivative from ContentItem? Is there another way to link pages among themselves?

Feb 8, 2009 at 6:37 PM
You usually retrieve the the content instances by traversing the object hierarchy

foreach(ContentItem child in parent.GetChildren())

An alternative to this is to store a reference on an item you can easily access, e.g. the start page. Take a look on the LoginPage property on the start page class.

The BuildUrl is used internally to calculate the Url property of each content item.