Suppose I have a section for Products, that uses the template at products/_entry and is set up to have the URL format of 'products/{slug}'.
Our existing page structure shows a Product page when you go to the URL (such as example.com/products/cool_product
, but we also have a sub-page for "Product Details" which we would get to (using the previous example) by going to example.com/products/cool_product/details
.
Is something like this possible with Craft routes? I've tried adding a route in craft/config/routes.php
that looks like:
return array(
'products/<slug>/details' => 'products/_details'
);
however that doesn't do what I'd expect, which is load the product entry using that slug and display the template (which would in turn display the relevant data from that product entry)
Do I need to have something in my _layout.html
that catches such a request somehow? I'm a bit confused I guess. I suppose I can handle the request a bit more manually in the template by parsing the request and loading the product that way. I guess I'm hoping there is something a little more elegant (read: I'm lazy )