[opencms-dev] Dynamically creating the code for the html head section in a template

Paul-Inge Flakstad flakstad at npolar.no
Wed Dec 2 10:16:31 CET 2009


Hi list

In a custom template, I want to create some of the code for the HTML <head> section dynamically.

For example, for some pages, I would like some specific code in the <head>, like:

<!--[if IE]>
<link href="/system/modules/my.gallery.module/resources/style/IE-gallery.css" rel="stylesheet" type="text/css" />
<![endif]-->

but for other pages I don't want it. The above is just a really simple example, it could be javascripts or whatever that one might want to include for a single page, instead of globally. If you use one global, hard-coded template, you will often include unneccessary javascripts, stylesheets and so on.

I have an idea or two on how to achieve what I want (my current choice: storing <head> section snippets as text files, and using properties to include snippets where needed), but I would very much like to hear from anyone who's done something similar; how did you solve this?

Best regards,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20091202/1fe1f948/attachment.htm>


More information about the opencms-dev mailing list