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

Open to all! Ask other shopowners for help.
Post Reply
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

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

Post 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?


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

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

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply