1

I tried asking before, but I am so bad at this it hurts. I was given a database which stores "products" (they are services) and information about them. Also i received part of an website that has a menu (some html and javascript). The relative links from this menu used to link to different pages build from that database (description page, details page, legal terms page.. one for every row in that database e.g. for each productId). The link are something like :

  • /productTitle/productInfo/

A real page using that structure would look like: /assurance/description/. A different page would use the same template, but with the change in the url new data would get served: /licence/description/.

Basically each part of that url plugs into an sql query: "... where productTitle = 'assurance' and productInfo= 'description'" and returns data into some kind of template.

I managed to use Petapoco to retrieve data from that database into an view, but the query was hard-codded into the controller and the url structure would just reflect the name of the view.

I tried storing views into folders, hopping that the structure would influence the url path, but i can't display .cshtml pages ( .aspx and .html files would work tho).

What must i do to have and url structure that passes it's data into an template? Do i need to manually create nodes in the umbraco admin area? tnx

1 Answers1

0

You need to look at the Umbraco Pipeline. https://our.umbraco.org/documentation/implementation/default-routing/inbound-pipeline/

I would think the thing you need to do is, after caching all the data you need on Application Start, you create your own ContentFinder that looks at the URL for a match and if it finds a product name and product info then it returns the Umbraco Page Id that it represents. https://our.umbraco.org/documentation/reference/routing/request-pipeline/icontentfinder

You then might need a controller to look at the URL again in order to display the correct data.

It's kind of a complex scenario for a quick answer, so perhaps check through this post: http://24days.in/umbraco/2014/urlprovider-and-contentfinder/

David
  • 727
  • 1
  • 6
  • 16
  • The other option is that use create actual Umbraco pages using the ContentService, but I wouldn't recommend this if the data is changing as you'll end up republishing the site every time it does. – David Jan 05 '16 at 15:00