$blockType->render('view') does not include view.css?
Permalink
I am running C5 5.4.1.1 and I am trying to hard code the previous_next block into my theme. It appears to be working correctly except for the fact that it is not rendering the views css file. Here is the code in my template:
Basically it renders and unstyled view of the block. Is this normal? Should I just embed the css into the view as opposed to having a separate file? Thanks.
<?php $bt = BlockType::getByHandle('next_previous'); $bt->controller->nextLabel = 'Next'; $bt->controller->previousLabel = 'Previous'; $bt->controller->showArrows =1; $bt->controller->loopSequence=1; $bt->render('view');?>
Basically it renders and unstyled view of the block. Is this normal? Should I just embed the css into the view as opposed to having a separate file? Thanks.
This happens for me as well. I'd just put that css in your theme stylesheet, and file a bug report.
Unfortunately, automatic header items and items called in on_page_view() are not automatically added to the header if they're included in this page. That's because the page has already started rendering by this point. Ideally, if you had code like this above elements/header.php:
You'd be able to output them into the header (and then embed the block into the page) but that currently doesn't work. Usually what we do in this instance is just to hard-code to the stylesheets into the header (which you can do, since you're obviously hard coding the block into the template.)
$btnp = BlockType::getByHandle('next_previous'); $btnp->controller->outputAutoHeaderItems();
You'd be able to output them into the header (and then embed the block into the page) but that currently doesn't work. Usually what we do in this instance is just to hard-code to the stylesheets into the header (which you can do, since you're obviously hard coding the block into the template.)