Here is my code...
$bt = BlockType::getByHandle('auto_nav'); // some more settings $bt->render();
But it's not working. It keeps loading and returns an "allowed memory exhausted" error after a while.
Seems that the "loadController" method in the BlockType class isn't working.
Having this issue in C5.8.3
It also could be that your autonav is just too big to display without running out of memory and you need to up the allotted resources for your site.
Just try only to load the block, no settings and no render... It will break immediately...
$bt = BlockType::getByHandle('autonav'); $bt->controller->orderBy = 'display_asc'; $bt->controller->displayPages = 'top'; $bt->controller->displaySubPages = 'relevant_breadcrumb'; $bt->controller->displaySubPageLevels = 'all'; $bt->render();
Sorry, but I made a mistake... I'm testing with an addon I'm trying to get online.
I've tried to add a block manually in the theme and it works! Just like you guys said. So that's that.
I tried to load a block in a controller of a dialog window in the Dashboard. There $app isn't available and the whole thing breaks...
So, fixed for now.