Hardcoded Breadcrumb autonav doesn't work

Permalink 3 users found helpful
Hi,

I'm trying to hardcode in a breadcrumb nav into one of my templates. I've created a scrapbook called 'Global scrapbook', added an autonav block to it and tried both setting the custom template 'breadcrumbs' in the block itself and from the option in the scrapbook, but the trail isn't showing.

This is the code I have in my template and I've named the block in my Global scrapbook 'Breadcrumbs'. It's appearing, but not showing the trail when I choose that custom template - any ideas of what's going on? I can add a block and make it a breadcrumb trail when I insert it as a normal block in Edit mode, but it's just not working when I use the autnoav from my Global scrapbook and apply the breadcrumb template...

<?php
$BreadcrumbsBlock = Block::getByName('Breadcrumbs');
$bv = new BlockView();
$bv->render($BreadcrumbsBlock);
?>


I've also attached a screenshot showing what I mean.

Thanks

osu

1 Attachment

osu
 
jordanlev replied on at Permalink Reply
jordanlev
I'm not entirely sure about this, but if the breadcrumb block is being placed on pages as an "alias", it might be looking to the actual global scrapbook's breadcrumb trail (which there isn't one because it's not really a site on the page -- even if it were, it wouldn't be the same as whatever page you were viewing that had the block placed on it).
If this is the case, perhaps you could try adding the block as a "copy" instead of as an "alias" to the page?
glockops replied on at Permalink Best Answer Reply
glockops
You could also skip the scrapbook and insert a hard-coded block directly into the theme.

Here's what I'm using
<?php 
    $bt_main = BlockType::getByHandle('autonav'); 
    $bt_main->controller->displayPages = 'top'; 
    $bt_main->controller->orderBy = 'display_asc'; 
    $bt_main->controller->displaySubPages = 'relevant_breadcrumb';
    $bt_main->controller->displaySubPageLevels = 'all';  
    $bt_main->controller->displayPagesIncludeSelf = 1; 
    $bt_main->render('templates/breadcrumb'); 
   ?>
duxferrarie replied on at Permalink Reply
Worked perfectly, thanks.
pauk replied on at Permalink Reply
Hi glockops

I am rather new to concrete

Could you please telle a bit more in how to
do this...

or even better attach a sample a it

Hope you can help :-)

REGARDS

Flemming
jordanlev replied on at Permalink Reply
jordanlev
The code @glockops posted is the sample -- just copy that and paste it into your theme template in the spot where you want the menu html to be.
pauk replied on at Permalink Reply
Hi glockops

I am rather new to concrete

Could you please telle a bit more in how to
do this...

or even better attach a sample a it

Hope you can help :-)

REGARDS

Flemming