Work with dynamic content spots
You can add dynamic content to custom theme by using either client-side or server-side logic.Client-side logic
You can add client-side logic, for example JavaScript, iWidgets, live text, to the WebDAV file store and reference it in the file theme.html.
Server-side logic
You cannot add a JSP to WebDAV, as it needs a servlet context to compile and execute. But you can reference a JSP in the file theme.html by using a dynamic content spot.
For details about the syntax and examples of referencing dynamic content in the theme.html template refer to topic about Writing theme HTML.
There are cases where it can be better to not reference the dynamic content directly, but rather reference it by a logical name.
- Reference by name abstracts the dynamic content away from the implementation. This is necessary if the theme needs to run on multiple runtimes, for example WebSphere Portal and Mashup Center. The portal implementation of the navigation tabs can be a JSP that contains portal specific code. The Mashup Center on the other hand cannot execute portal JSP code, but provides an iWidget instead.
- Reference by name isolates the theme author from having to know the underlying code information. This is useful if the theme author is an HTML and CSS designer, but not a J2EE or JavaScript developer. The HTML and CSS developer needs to know only the list of named content spots and the simple syntax to add it. This developer can then write code without having to know JSP path names etc.
Examples:
- Including a named dynamic content spot mapping:
<a rel="dynamic-content" href="dyn-cs:/tabNav"></a>
Including a theme JSP directly: <a rel="dynamic-content" href="res:/PageBuilder2/themes/html/PageBuilder2.0/tabNav.jsp"></a>
Including an iwidget definition: <div class="iw-iWidget id="myWidget"> <a class="iw-Definition" href="/path-to-widget-definition.xml"></a> <span class="iw-ItemSet" style="display:none" title="attributes"> <a class="iw-Item" href="#key">value</a> ... </span> </div>
Configure and modifying named dynamic content spots
The named dynamic content spots are defined in a Resource Environment Provider (REP) named WP DynamicContentSpotMappings in the WAS administrative console. By default the portal installation has the following named content spots defined:Table 1. Named content spots shipped in a default portal installation
Name of the content spot Value Description head res:/PageBuilder2/themes/html/PageBuilder2.0/head.jsp The head section of the theme bannerNav res:/PageBuilder2/themes/html/PageBuilder2.0/bannerNav.jsp The banner navigation of the theme search res:/PageBuilder2/themes/html/PageBuilder2.0/searchAndEdit.jsp The search widget bannerCommonActions res:/PageBuilder2/themes/html/PageBuilder2/bannerCommonActions.jsp The username, actions menu, help link, login/logout status res:/PageBuilder2/themes/html/PageBuilder2/status.jsp The status bar for the theme tabNav res:/PageBuilder2/themes/html/PageBuilder2.0/tabNav.jsp The tabbed navigation with drag and drop and submenus pageToolbar res:/PageBuilder2/themes/html/PageBuilder2.0/pageToolbar.jsp The toolbar displaying buttons for customization layout lm:template Renders the layout of the page asa res:/PageBuilder2/themes/html/PageBuilder2/asa.jsp Active site analytics config res:/PageBuilder2/themes/html/PageBuilder2/config.jsp The config for the theme, setup of ibmCfg object Caching:
The parameter max-age can be set on a dynamic spot POC URL to define caching. The value for max-age is set in seconds, while a value of -1 means that information is cached for as long as the server is running. A server restart refreshes the cache.
Example:
res:/PageBuilder2/themes/html/PageBuilder2/spot.jsp?max-age=604800You can modify this configuration by using the WAS administrative console. When you work with this configuration, observe the following hints and tips:
- To change the implementation of a JSP, do not modify the version of the JSP provided with the portal. Either change this configuration to point to own JSP in own WAR file, or reference this JSP directly in theme and bypass the configuration.
- The REP configuration is global, not per theme. Therefore, if you change the configuration, the change applies to all themes in the portal.
- To override a configuration for a specific theme only, set a theme metadata parameter with key=com.ibm.portal.dynamic-content-spot.dynamic spot name and a value equal to the overriding POC URL (Piece Of Content URL). An override requires the theme to be specified on the dynamic content spot. You can specify the theme by using @tl:oid:<theme unique name> at the end of the mapping name.
Example: <a rel="dynamic-content" href="dyn-cs:tabNav@tl:oid:csa2.theme"></a>
- Theme metadata is easier to modify than the REP: Theme metadata is accessible for updates through the themelist entry point on WebDAV and does not require a server restart for the changes to take effect. You might consider overriding the defaults through theme metadata, particularly at development time, even if the changes are global in production
When viewing metadata through the themelist WebDAV entry point, all keys with the prefix com.ibm.portal are hidden from view. You can add the metadata using this entry point and it will be applied, but after persisting the change to the back-end, reopening the metadata properties file might not display it.
- You are not limited to the dynamic spots that are shipped with the portal. If theme design requires additional named content spots, you can add them.
- Changes to the Resource Environment Provider require a server restart to take effect.
Develop custom themes
Related reference
Page Builder theme templates (theme.html)
December 14, 2011
Apr 1, 2011 4:55:28 PM Apr 1, 2011 1:26:17 PM
});