Page 1 of 1

$oscTemplate->addBlock in header_tags does not work in PI Module

Posted: Tue Jan 25, 2022 11:15 am
by loop
Hi all
i try to make a new PI Module (image gallery with swipping) and i need to have js and css code in the header
i tried:

Code: Select all

function getOutput() {
global $oscTemplate;
$oscTemplate->addBlock('<tester>', 'header_tags');
}
but <tester> will not be put in header, if i change 'header_tags' to 'footer_scripts' it's inserted in the footer, but i need it in the header

i also tried this in _construct() but same result

in template_top.php there is the line:

Code: Select all

echo $oscTemplate->getBlocks('header_tags');
so i really don't know why it's not inserted there

any ideas?

Re: $oscTemplate->addBlock in header_tags does not work in PI Module

Posted: Tue Jan 25, 2022 11:22 am
by ecartz
You need to add the block before template_top is called. The PI module runs after. Move it into an appropriate hook instead.