Monday, January 31, 2011

How To Add Style Sheet URL Dynamically To XPages? (xp:headTag)

The following is a way using which u can include style sheets into xpages in a dynamic fashion. Yes it lets you compute style sheet URL in the XPage.

Note the usage of the scoped variables along with custom text in constructing the url of the style sheet

<xp:headTag tagName="link" rendered="true" loaded="true">
         <xp:parameter name="rel" value="stylesheet"></xp:parameter>
         <xp:parameter name="type" value="text/css"></xp:parameter>
         <xp:parameter name="href" >
<![CDATA[#{javascript:return applicationScope.get("scopeVariableNameContainingURL")+"leftouturl/filename.css"}]]>

To know about including client side script libraries in a similar fashion click here
Hope this helps :)

No comments:

Post a Comment