Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Adding <body> attributes programmatically


Go to End


2 Posts   1493 Views

Avatar
spenniec

Community Member, 37 Posts

9 May 2008 at 5:27pm

Edited: 09/05/2008 5:48pm

Hi,

I want the ability to add some event attributes to the <body> tag of a Page but do so only through programming, not via a control or variable in a template file. I was thinking it would work like the Requirements includeInHtml method which seems to do the string replacing on the </head> tag

Is there something like that already available?

My question is:
What calls Requirements::includeInHtml in the execution pipeline/rendering process so I can look at writing a class and methods to add the attributes?

Seek and ye shall find. Answered my own question, it is SSViewer.php, what's my next move?

Avatar
Sam

Administrator, 690 Posts

9 May 2008 at 6:00pm

Why not use Requirements::javascript() to include a js file that sets window.onload?