+

Search Tips   |   Advanced Search

Create dynamic content spots using modules

The modularized approach is generally more flexible than defining dynamic content spots through Resource Environment Providers, allowing us to switch spots per page, and override existing content spots. We define dynamic content spots in theme.html. For example, to render the top navigation, edit theme.html and insert....


Create a dynamic content spot

  1. Define the module as a JSON file or as part of a plugin.xml file.

    The dynamic content spot ID is defined within the ref-id attribute on the sub contribution.

    • The following example shows the definition of a module using the JSON format that will override the default module. Add the file in WebDAV at...

        fs-type1/themes/myTheme/contributions/

      {
       "modules": 
       [{ "id" : "topnavoverlay",   
          "prereqs": [{ "id":"wp_dynamicContentSpots_85" }],
          "contributions": 
          [{ "type":"dyn-cs",
             "sub-contributions": 
             [{ "type":"markup",
                "ref-id":"85theme_topNav",
                "uris": [{ "value":"res:/your/sample.html" }]
             }]
          }]
       }]
      }

      id Any meaningful ID unique to the system.
      ref-id The ID of the dynamic spot to override. In this example, it is 85theme_topNav.
      value A pointer to the markup for the dynamic spot. In this example, it points to an HTML file relative to the theme location in WebDAV. To point to a .JSP file, define the module within a plugin.xml file.
      prereqs The name of the module required or overridden by this module.

    • We can also define the override module in a plugin.xml file.
      <extension point="com.ibm.portal.resourceaggregator.module" id="topnavoverlay" >
          <module id="topnavoverlay">
             <preqreq id="wp_dynamicContentSpots_85"/>
             <contribution type="dyn-cs">
             <sub-contribution type="markup" ref-id="85theme_topNav">
               <uri value="res:/your/sample.jsp" />
               </sub-contribution>
             </contribution>
         </module>
      </extension>

      extension id Any meaningful ID unique to the system.
      module id Any meaningful ID unique to the system.
      sub-contribution ref-id The ID of the dynamic spot to override. In this example, it is 85theme_search.
      uri value A pointer to the markup for the dynamic spot.
      prereqs The name of the module required or overridden by this module.

  2. Include the module in a profile. For example, file...

      fs-type1/themes/myTheme/contributions/newtopnav_profile.json

    ...would have...

    {{
      {
       "moduleIDs": [
       "topnavoverlay",    
       ...
    }}

    Copy newtopnav_profile.json to WebDAV at...

      fs-type1/themes/myTheme/profiles/

  3. Apply the profile to a page hierarchy.

    We can change the profile for the theme or a specific page to define the modules that are loaded.


Parent Create dynamic content spots

Related tasks:
Create a module profile
Change the theme profile