Including header elements in an included block

Permalink
Hello,

I'm currently including sponsoren.php with this code:
<?php $this->inc('elements/sponsoren.php'); ?>


Then in sponsoren.php this to get a slider from my scrapbook:
<?php
  $b = Block::getByName('sponsorslider');
  if (


However, it's not loading the JS/CSS so I thought I'd use this:
<?php
        public function on_page_view() {
                $html = Loader::helper('html');
                $this->addHeaderItem($html->javascript('/packages/simple_image_slider/blocks/simple_image_slider/js/carousel.js'));
                $this->addHeaderItem($html->css('/packages/simple_image_slider/blocks/simple_image_slider/view.css'));
        }?>


However, this doesn't work and I can't get it working ... any suggestions?

DoorDarius
 
noconceptnoglory replied on at Permalink Best Answer Reply
noconceptnoglory
You can't add a header element within an include, because the whole head section has already been loaded. This is just impossible...
I suggest you add the css and the javascript to your theme.
Good luck!