Hi All,

Tomahawk's ExtensionsFilter allows components to cause data to be inserted into 
the HEAD section of a generated HTML page, even when they occur in the body. In 
particular, this allows components to output references to javascript and css 
that they need. This is extremely useful, but the implementation is rather ugly.

I know almost nothing about Trinidad, but it presumably has something similar, 
in order to provide default skins for its components. Would someone be kind 
enough to give a very brief summary of how Trinidad achieves this? I'm hoping 
that there is something there I can steal to improve Tomahawk's approach.

Currently, tomahawk ExtensionFilter's standard approach is to buffer the entire 
output. As each component renders itself, it can register resources it needs in 
a request-scoped variable. After rendering is complete, the ExtensionFilter 
scans the buffered output for the closing </head> tag and similar bits, and 
inserts and registered resources into the buffer. This is inefficient due to 
the buffering, and the code is complex (a simple HTML parser is needed!).

Thanks,

Simon

Reply via email to