BlockType::getByHandle
Permalink
Working with a static block in a theme.
Here is my code...
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
Any suggestions?
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
Any suggestions?
Tried this and still no joy....It's not working.
Just try only to load the block, no settings and no render... It will break immediately...
Just try only to load the block, no settings and no render... It will break immediately...
Can you explain what "It will break immediately" means? Do you see an error? Does it throw the same out of memory error? Have you tried upping your timeout and allowed memory on the server?
I suspect it is missing various settings.config, so causing a code error, such as method on non object.
It keeps loading until the browser tells me that the page can't be loaded. It looks like an loop or something. There are no errors or something. Upping time and memory just takes longer for the browser to break, but it still breaks. I think this is a 8.3.2 bug. Could you guys check in a testing environment?
I placed this into my default.php in a test environment and it displays as expected
$bt = BlockType::getByHandle('autonav'); $bt->controller->orderBy = 'display_asc'; $bt->controller->displayPages = 'top'; $bt->controller->displaySubPages = 'relevant_breadcrumb'; $bt->controller->displaySubPageLevels = 'all'; $bt->render();
In 8.3.2?
Yes.
Try using ('autonav') instead of ('auto_nav')
Hi guys,
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.
Thanks!
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.
Thanks!
https://documentation.concrete5.org/developers/working-with-blocks/w...
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.