Forum Discussion
The problem is that when the head gets rendered (where you rightfully would need the preloads etc.) we do not yet know if the page coming up will contain your component. So we cannot make that distinction. What you are effectively asking is: Can I modify the whole DOM from within a component on the server-side. It's an interesting thought, but this does not seem to be possible as the component is a self-contained element. It also conflicts with the Freemarker logic as that is that of a mere templating language.
What would be possible (to get everything into the component itself) is that you could have a parameter that you pass into your component and with that set, you only render the head/preload/.. tags. Then you can call your component from within the head_top component. At least that moves the logic out of there. What remains is to scope this only to the pages where this gets used - and THAT is not possible automatically, thus the component rendering call in the head_top would need to guarded by something like <#if page.name == FroumTopicPage> given you use your component there. That is the best we could do. We just do not know at that point in time if this is needed or not.
I was hoping that maybe some hooks could be used similar to <#nested> and <@delegate> put together with some sugar on top. For example, if I mark a spot in my template's head as <@head_content append=true />, and then individual components would provide <@head_content>abc</@head_content> in order to append more code to the head tag. I have seen this technique in other templating languages, but I if it is not possible, will have to figure out how to make it work as smooth as possible in Khoros+freemarker
Related Content
- 4 years ago
- 13 years agoInactive User