Forum

Thread tagged as: Question

Is it possible to display a breadcrumb nav from within a content template?

I have product pages where everything but the header and footer are generated from a single product content template.

The design requirements call for a breadcrumb nav. Normally, I'd put the breadcrumb code in the master page template just above the product content, but the design requirements have the breadcrumb appearing after some of the product content. Is there some way to display a breadcrumb in this manner?

Thanks!

Franz Neumann

Franz Neumann 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can generate it and then pass it into the template

$breadcrumbs = perch_pages_breadcrumbs(array(), true);
PerchSystem::set_var('breadcrumbs', $breadcrumbs);

And then in your template:

<perch:content id="breadcrumbs" encode="false" />

So the second line of code goes in my product content template, but where does the first code snippet need to appear? This is for a Perch Runway project.

Thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

It just needs to happen before the template is used.