IPathFinder

Apr 10, 2009 at 8:20 AM
I noticed that the IPathFinder and the TemplateAttribute allow for the use for templates and actions.

Can these actions be treated as dynamic parameters?

My situation...

I have a category page. The name of the ContentItem (url) is "category_1" and I do parsing to get the ID. This requires a lot of overriding and it is unstable.

Can I possibly use something like "www.website.com/store/category/1.aspx"?

Would something like this require my to go into the source or is there something I'm not seeing or noticing?
Apr 11, 2009 at 9:59 AM
I figured it out and the answer is yes, N2CMS does support that scenario.

I'm so excited! ;)
Apr 11, 2009 at 2:25 PM
Yeah, u've got it right. Some time ago Cristian made this trick with named parameters an official way to support additional templates. So u can supply an alternative templates for a sub-URL:
[Template("MyItem.aspx")] => url(.../my-item.aspx)
[Template("$json", "Json.ashx") => url(.../my-item/$json.aspx)
...etc

What's more exciting is that u can apply [Template] attribute to existing items without touching the latter. All u need is to create a PluginInitializer, on it's starting up find a suitable ItemDefinition and call .Add(new TemplateAttribute(...)) on it.


btw, do u happen to work on a sort of 'Catalog' thing ? Maybe u're familiar with Drupal's Taxonomy module ? That's a kind of universal catalog with pluggable view engine and URL rewriting capabilities. I wonder is it possible to bring that to N2/ASP.Net on a large scale..