Modules and dynamic content spots
Overview
Dynamic content spots and markup contributions are both techniques for adding HTML to a theme.
- Markup contributions are placed at the end of the body of the page.
- Dynamic content spots render wherever they are placed in the theme HTML template.
Use a markup contribution if it is not important where the module is in the page, such as with iWidget definitions. If the markup must appear in a particular spot in the theme, use a conditional dynamic spot.
Use the modularized framework for dynamic content spots to override spots defined through resource environment providers.
Dynamic Content Spots on a page
If a page profile does not contain a content spot ID used in theme.html, nothing is rendered. Matching IDs will render the dynamic content spot using the specified URI.
To use the same dynamic content spot on two different pages with the same theme, but with different markup, reference different profiles, with each containing a different content spot module. For example, to have a Home page with inline top navigation, and an Applications page with fly-out navigation, with each using identical theme.html files...
<a rel="dynamic-content" href="dyn-cs:id:85theme_topNav"></a>
Create two modules and two profiles to create the two pages with different markup.
- Modules:
topNavModule Renders inline top navigation. Sub contribution with ref-id 85theme_topNav pointing to a JSP provided by this module. flyoutNavModule Renders fly-out navigation. Sub contribution with ref-id 85theme_topNav pointing to a JSP provided by this module.
- Profiles:
HomeProfile Renders inline top navigation. Contains topNavModule. ApplicationsProfile Renders flyout top navigation. Contains flyoutNavModule.
Override dynamic content spots
We can override any dynamic content spot defined through resource environment providers. Dynamic content spots in modules overrule the dynamic content spots in resource environment providers. However, we can override dynamic content spots defined through modules. To render the dynamic content spots in the correct order, create a module that defines a prereq on the module that defines the previous dynamic content spot.
To override the default dynamic content spot for search wp_search_dynspot, create a module that defines a prereq on wp_searchbar. This module renders this particular dynamic content spot ID.
Parent Dynamic content spotsRelated concepts:
Writing modules