This is a page of notes for doing various things in IBM LWCM. It is intended to serve as a quick reference to common things.
- Link to portal page and a WCM Site
- Render content title from within a Menu Component
- Call a Library Component directly from URL
- Use pageDesign parameter to force alternate page design
- Reference the exact categories of a content item in a presentation template
- Reference the current site area name in a presentation template
- Reference an Image Element and render URL only
- Reference an Image Element and render the full Image tag
- Reference an element in content from a Presentation Template
- Include a JavaScript file from a File Resource Component
Link to portal page and a WCM Site
This snippet shows an example for how to link to a specific portal page and a WCM Site. The portal page is defined by a friendly URL mapping in WPS. In this case that URL mapping is called View. The View page is identified in the tag as the portalTarget. The portal page must have a WCM content display portlet that is configured as a listener.
Note: If successfully configured, this tag should automatically generate an id attribute on save.
Back to topRender content title from within a Menu Component
When used in the "Design for each menu search result:" section of a Menu Component, this tag will render the title of the current content item being iterated over:
Call a Library Component directly from URL
For example: If you have a menu component that renders a search seed list or XML, you may want to request that menu component directly instead of having to reference it on content and then request the content.
in WCM 5.1
in WCM 6.1
So how do you generate such a URL? Just use the PREVIEW feature in WCM and preview in the WCM servlet context (not through a portal page), then take a look at the URL.
Back to topUse pageDesign parameter to force alternate page design
in WCM 6.1
For example, to force the search engine to index against a special presentation template, the following could be used in your search seed list:
Reference the exact categories of a content item in a presentation template
Reference the current site area name in a presentation template
Reference an Image Element and render URL only
Where key = the name of the Image element as defined on the authoring template.
Note that the autofill context is typically used in Menu components.
Reference an Image Element and render the full Image tag
Where key = the name of the Image element as defined on the authoring template.
Note that the autofill context is typically used in Menu components.
Reference an element in content from a Presentation Template
Referencing a content element from a Presentation Template is one of the most common tasks you'll perform when creating Presentation Templates. Suppose that an Authoring Template has a Rich Text element called "body" added to it and you would like to render the content of that element in your presentation template. Here's how:
- context="current" - means that we're retrieving from the current content item that is open for view.
- type="content" - means that we're fetching the element from the content item, not the site or site area.
- key="body" - means that we're fetching the value of the content's Rich Text element named 'body'.
Include a JavaScript file from a File Resource Component
In a Presentation Template, you can include a JavaScript file by referring to a File Resource Component that holds the JS file like this:
3 Comments
comments.show.hideJan 11, 2010
Anonymous
Good Shortcuts
Nov 12, 2010
Anonymous
looking for the method to add alt text to an image for accessiblity. <Element context="autoFill" type="content" key="Image" format="tag"> does not add it...
Jun 09, 2011
Cody Burleson
In what version? In 6.1.5, image elements provide an alt text field, which when used by authors should create what you want. Alternatively, you can construct the tag yourself. Instead of using format="tag" use the start="" and end="" attributes.