For my own usage I had update the package to allow the use of up to 5 wildcard elements, but hadn't released before because I wanted to test properly before releasing.
Now that someone requested this functionality, I have completed my tests, and updated AutoRouteTemplate to version 2.0.0.
I'm big on using controllers in Umbraco, so yeah I really should make a proper extension method to help access the umbracoParam array that exists in the session variable from a controller. Until I do, and I apologise for not making this simpler, its only laziness on my part.
public override ActionResult Index(RenderModel model)
{
string[] wildcardParameters = UmbracoContext.Current.HttpContext.Items["umbracoParam"] as string[];
if (wildcardParameters == null)
{
// There are no wildcard parameters
return CurrentTemplate(model.Content);
}
if (wildcardParameters.Length == 1)
{
// They typed only 1 wildcard parameter
return CurrentTemplate(model.Content);
}
// They typed two or more wildcard parameters
return CurrentTemplate(model.Content);
}
Informations about your package
Hi, I would try your package in my website. I created an umbraco node called "data" (url: www.mydomain.com/data - doctype: data).
This will have 4 virtual children:
www.mydomain.com/data
www.mydomain.com/data/edu
www.mydomain.com/data/edu/italy
www.mydomain.com/data/edu/italy/institute
www.mydomain.com/data/edu/italy/institute/public
The "edu, italy, institute and public" are the 4 parameters I must use to filter some data.
Can I use your package for my need?
I'm using Umbraco v7.4.3
Thank you in advance. Best regards.
Adriano
Hi Adriano,
For my own usage I had update the package to allow the use of up to 5 wildcard elements, but hadn't released before because I wanted to test properly before releasing.
Now that someone requested this functionality, I have completed my tests, and updated AutoRouteTemplate to version 2.0.0.
Please enjoy
Jonathan
Thank you Jonathan, I'll try your package ASAP.
I hope this is perfect for my need.
Have a good day Adriano
Hi Jonathan, the package is what I need and when I tried it in a simple project, it function properly.
When I try to use it in my custom controller, I don't find the "UmbracoParam()" method.
I also referenced AutoRouteTemplate in my custom project, but when I try to create the params array, I don't find your method in my custom controller.
I tried also this but I suppose I first of all should use a method that sets the url parameters to the label:
Can you help me?
I tried to search also in our.umbraco, but I didn't find what I need...maybe I'm wrong the research.
Thank you
Adriano
Hi Adriano,
I'm big on using controllers in Umbraco, so yeah I really should make a proper extension method to help access the umbracoParam array that exists in the session variable from a controller. Until I do, and I apologise for not making this simpler, its only laziness on my part.
Hope this helps
Jonathan
Hi Jonathan, thank you for your help...I solved with this code.
I don't know if this is the best way to do that, but for now it is fine
Have a nice day.
Adriano
is working on a reply...