view.css & view.js not loading when calling a block from the api
Permalink 2 users found helpful
Hi!
I made a new template for the autonav (concrete 5.4.1.1) so i created the following:
blocks/autonav/templates/mynewnav/view.php
blocks/autonav/templates/mynewnav/view.css
blocks/autonav/templates/mynewnav/view.js
Now, when I include this navigation in a page over the concrete5 panel everything works fine and view.css and view.js get called in the header.
But if I call the autonav over the API, then the .css and the .js get not included.
My call looks like this, should be alright:
I also tried to make next to the view.php an additional folder called "css" and one called "js" and set the files in there named mynewnav.css and mynewnav.js, but no luck...
Is this a bug or is it me? ^^
I made a new template for the autonav (concrete 5.4.1.1) so i created the following:
blocks/autonav/templates/mynewnav/view.php
blocks/autonav/templates/mynewnav/view.css
blocks/autonav/templates/mynewnav/view.js
Now, when I include this navigation in a page over the concrete5 panel everything works fine and view.css and view.js get called in the header.
But if I call the autonav over the API, then the .css and the .js get not included.
My call looks like this, should be alright:
<?php $bt_main = BlockType::getByHandle('autonav'); $bt_main->controller->mainCollection = $c; $bt_main->controller->displayPages = 'top'; $bt_main->controller->orderBy = 'display_asc'; $bt_main->controller->displaySubPages = 'all'; $bt_main->controller->displaySubPageLevels = 'custom'; $bt_main->controller->displaySubPageLevelsNum = '3'; $bt_main->render('templates/mynewnav/view'); ?>
I also tried to make next to the view.php an additional folder called "css" and one called "js" and set the files in there named mynewnav.css and mynewnav.js, but no luck...
Is this a bug or is it me? ^^
bump!
Got my Answer thanks to Ryan:
"Because the page has no idea you're calling a block statically in code until it's actually rendering that portion of the page and header items that would normally be added are not added.
If you do call any block in code like that you'll need to manually add the required header items yourself."
"Because the page has no idea you're calling a block statically in code until it's actually rendering that portion of the page and header items that would normally be added are not added.
If you do call any block in code like that you'll need to manually add the required header items yourself."
Same happens when you call a block from another page. Makes sense, thank you.