Forum

Thread tagged as: Question

Breadcrumbs

Hi,

Is it possible to grab the value i've appended to string from the url and add this to breadcrumb link in a custom breadcrumb template?

cheers

Steve Forbes

Steve Forbes 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you should be able to pass stuff into the templates as normal.

https://docs.grabaperch.com/docs/templates/passing-variables-into-templates/

Hi Drew,

Giving this a go, so i can set var's on perch_pages_breadcrumbs not just perch_custom?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, on anything that uses a template.

Guys you need a paid forum, as i filly guilty every time i post.

So i have this

<?php 
    PerchSystem::set_vars(array(
        'test'=>'hello',
    ));
    perch_pages_breadcrumbs(array(
        'template'=>'breadcrumbs--custom.html'
    )); 
?>  

and would this make the id "test" now available like so in my template.

<perch:before>
<ul class="breadcrumbs">
</perch:before>
    <li>
        <perch:if exists="perch_item_last">
            <perch:pages id="pageNavText" />
        <perch:else />
            <a href="<perch:pages id="pagePath" />?s=<perch:content id="test" type="slug" />"><perch:pages id="pageNavText" /></a>
        </perch:if>
    </li>
<perch:after>
</ul>
</perch:after>

also ive tried

<?php 
    PerchSystem::set_var('test', 'hello');
    perch_pages_breadcrumbs(array(
        'template'=>'breadcrumbs--custom.html'
    )); 
?>  

I done it!! had perch:custom instead of perch:pages

cheers guys.