Forum
List detail pages in navigation
Is there any way of automatically adding the detail page links generated from a list and detail setup to perch navigation?
Is there any way of automatically adding the detail page links generated from a list and detail setup to perch navigation?
No automatic way currently. They're not actually pages, so they don't appear. The only way is manually - generate the HTML and pass it into the template.
Hi Richard, I had to do this for a site which had it's products as 'list and detail' pages. I wanted to show the products listed in the main nav.
Here's how I did it:
First get the list of list and detail pages and pass them into a variable to be used on the nav, then show the nav on the page...
I wanted the products to show in a dropdown from one of the main nav links, so, above you can see I have used two templates for nav: level1.html for the top-level and level2.html for the dropdown.
level1.html is fairly standard:
level2.html is where we call the variable that we set earlier:
I hope that helps.
Thankyou Simon and Drew, Currently I've just been adding them as pages with a link to the generated url. My client has multiple treatments which need to link to multiple conditions and vice-versa so I need each detail page to appear when using the 'pagelist' field. We have a system that works, but just wanted to know if there was an easier way.
Yes, I see.
The code above wouldn't add them to the pagelist field type.
But you could use dataselect to generate a list of those pages to choose from: https://docs.grabaperch.com/docs/templates/attributes/type/dataselect/
Hmm, haven't used that before, that just might be perfick. Thanks!
Worked Like a treat, thanks Simon!
Great! :)