The Portal product documentation describes how to create custom themes and you may have already created a custom theme with static components in WebDAV and dynamic components in a WAR file. This article describes how you can create a theme with all the components together in one WAR file.
The process to create this kind of theme is divided into five parts:
1. Create the WAR directory with the dynamic resources
2. Add the static resources to the WAR
3. Deploy the WAR
4. Register the theme
5. Modify the static resources in the WAR directory
Create the WAR directory with the dynamic resources
Follow the steps at Copy the dynamic resources for your theme
to create the WAR directory with the dynamic resources.
Before the Export -> EAR File step, add the static resources to the WAR as follows.
Add the static resources to the WAR
Follow these steps to add the static resources to the WAR:
1. Locate the Portal 8.5 theme folder in the WebDAV file store using the URI:
2. Copy the entire Portal8.5 WebDAV theme folder to be the "/themes/html/CustomThemeName" folder within your WAR.
Deploy the WAR
Continue with the steps at Copy the dynamic resources for your theme from the Export -> EAR File step to the end to export and deploy the WAR.
1. Document the context root you assigned to the WAR as it will be used later.
Register the theme
1. Export the themes using this xml file:
<?xml version="1.0" encoding="UTF-8"?>
<theme action="export" objectid="*" />
2. Locate the Portal 8.5 theme (the uniquename is "ibm.portal.80Theme") and remove all other <theme /> tags and all their child tags.
3. Remove the objectId attribute and its value from the
If you fail to remove the objectId you will end up modifying an existing theme.
4. Ensure that the "default" attribute on the
element is set to false.
5. Change the "context-root", "resourceroot" and "uniquename" attributes to match your custom theme WAR that was created in previous steps.
6. Change the theme title on the <localedata /> tags for the locales in which your Portal supports.
7. Change the "com.ibm.portal.friendly.name" parameter, if it exists, to differentiate this theme from the others.
8. Change the "com.ibm.portal.theme.template.ref" parameter to point to your new custom theme context root.
<parameter name="com.ibm.portal.theme.template.ref" type="string" update="set">
"CustomThemeName" is the context-root of your theme. "CustomThemeDir" is the name of your theme directory in the WAR.
9. Save these modifications as a new xml file, as to not overwrite the original export of all themes.
10. Import the new xml file using xmlaccess.
Modify the static resources in the WAR directory
1. Change all the dynamic-content spots in theme.html (or theme_<locale>.html) to point to the dynamic resources in your new WAR file.
Example of out-of-box dynamic-content spot:
<link rel="dynamic-content" href="dyn-cs:id:80theme_head">
<link rel="dynamic-content" href="res:/customTheme/themes/html/dynamicSpots/head.jsp">
where customTheme is the context root you assigned to your WAR.
You now have a functional custom Portal 8. theme that can be assigned to pages without the static resources being located on WebDAV.
Problem: The context-root of your new web applciation can not be found
Solution: Make sure you started the new enterprise application. Also, if you are accessing the portal via the Web server then make sure you re-generated the plugin file and distributed it to the web servers. Also, make sure you mapped the WAR module to both your Portal server and your web server.
Problem: Your xmlacces import changed the base Portal 8.0 theme
Solution: To do an Export of data, you must use the xmlaccess client found in PortalServer/bin directory. The syntax is documented here:
basically, you want it to look like:
xmlaccess -in /ExportThemes.xml -out myExport.xml -user -password -url http://:/wps/config
This will give you a myExport.xml that you can then modify per the directions and import via the ImportXml option in the Administration page.