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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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