I'm slowly getting the hang of Umbraco - yay. The one area where I'm stuck is working with pages that don't require an editor. How do I go about adding those pages, and where should the controller(s) for those pages go in the project (they have data that is pulled from a database outside of Umbraco)?
Is there a specific way I'm to write the controller to override Umbraco's? Also where IS Umbraco's controller in the project for pages that does use the content editor?
It depends a bit on the type of thing you want to do with the page - but if you are looking to add pages via controllers, you should look at the routing documentation .
These allow you Do put pages in a more traditional MVC type way - the documentation assumes you are still getting content from Umbraco, but it doesn't have to work like that.
Adding pages that don't require an editor - how?
I'm slowly getting the hang of Umbraco - yay. The one area where I'm stuck is working with pages that don't require an editor. How do I go about adding those pages, and where should the controller(s) for those pages go in the project (they have data that is pulled from a database outside of Umbraco)?
Is there a specific way I'm to write the controller to override Umbraco's? Also where IS Umbraco's controller in the project for pages that does use the content editor?
TIA!
Hi Nancy,
It depends a bit on the type of thing you want to do with the page - but if you are looking to add pages via controllers, you should look at the routing documentation .
https://our.umbraco.com/documentation/Reference/Routing/
It details the main options you have
Custom MVC Routes (https://our.umbraco.com/documentation/Reference/Routing/custom-routes)
These allow you Do put pages in a more traditional MVC type way - the documentation assumes you are still getting content from Umbraco, but it doesn't have to work like that.
Custom Controllers https://our.umbraco.com/documentation/Reference/Routing/custom-controllers these let you change how a page or template is rendered (so the page would exist in Umbraco - this intercepts how the template/view is managed.
Surface Controllers https://our.umbraco.com/documentation/Reference/Routing/surface-controllers Are a lot like standard MVC controllers and automatically get given a route by Umbraco but it is under /umbraco folder (so you might not want this
Content Finders https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/IContentFinder Content Finders and UrlProviders let you integrate with Umbraco's process for finding a page, most often you put something in that means if Umbraco can't find an URL your content finder is called, you can then use that to work out if the URL is something you want to provide a page for and set the values accordingly. (a good example of this here https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/)
Update: Should add, if it's an HTML file you can just put it on the site, and it will be served up - but you probably didn't mean that :)
Ha I wish it was just a HTML file. It's a little more complicated than that. I'll work through the documentation and do some testing. Thank you!
Any chance there is an existing Umbraco site on Github that showcases custom controllers and routing?
is working on a reply...