This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Witsly
Witsly

I was trying to add some piece of html code into <head> and <footer>. I know we can use onRender method to push html code in page. But I'm looking for a way to push code either into header or footer.

Mohsin
Mohsin

One word: Placeholders!

You can find it in the OctoberCMS documentation. Just use the styles and scripts placeholders as they correspond to header and footer.

daftspunky
daftspunky

That's right, {% scripts %} is a placeholder alias block called "scripts", identical to

{% placeholder scripts %}

You can easily append content to this block with the following PHP code

\Block::append('scripts', '<script>alert("hello")</script>');
Witsly

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.