+

Search Tips   |   Advanced Search


Component tag - WCM

The Component tag is used to reference the content of a component within a presentation template or element design.

<Component name=" " 
           context="autofill" 
           format=" " 
           separator=" " 
           compute=" " 
           htmlencode=" " 
           awareness=" " 
           start=" " 
           end=" " />

<Component Opens a library component tag.
name=" " Name and library of the component being referenced.

For example...

    name="library/item"

To use the library specified in the URL of the current page, use...

    name="./item"

If you specify name="./item", the library name will not appear in your presentation template or element design. The actual path will not be resolved until the item is rendered.

The "name" parameter is not used if context="autofill".

context="autofill" Used when referencing a Component tag within a Personalization element design to display the results of a Personalization rule that searches for components.
start=" "
end=" "
The start and end attributes are used to wrap the data returned by a tag within other tags, such as HTML. These attributes are not mandatory.
format=" " Optional and can only be used with some component types:

When referencing an image component:

To only render the URL of an image component.

    format="url"

To render a complete image tag. The image will be displayed on the rendered page. This is used by default if no format is specified.

    format="tag"

When referencing a file resource component:

If your file resource is a file type that can be converted to HTML you can instead convert the file to HTML and render the converted HTML directly in your Web content using the format="HTML" parameter.Examples of supported file types include:

  • word processing documents (*.doc, *.odt)
  • spreadsheets (*.xls) *
  • HTML files (*.htm, *.html)
  • Text files (*.txt)

Other file types may also work but test them first.

Maximum Cache Size

If the converted HTML is larger than the default cache size defined by the resourceserver.maxCacheObjectSize property in WCMConfigService.properties, each request that contains this file will be converted dynamically instead of using the cached copy. This will impact performance. You may need to increase the size of the resourceserver.maxCacheObjectSize property to support large file conversions. Before doing this your should verify the system has enough memory installed to cope with the increase in cache size. You could also break up the file into separate files that can be converted separately instead of increasing the cache size.

When referencing file resource and image components:

  • To render the mime type of a file or image...

      format="mimetype"

    If no valid mime type can be determined then "www/unknown" will be rendered.

  • Use format="filename" to render the name of a file or image.

  • Use format="size" to render the size of a file or image using the most appropriate unit. If the resource is smaller then 1K then the size in bytes will be rendered. If the size of the resource is less then 1MB then the size in kilobytes will be rendered. If the size is greater than or equal to 1MB then the size will be rendered in megabytes.

  • Use format="size_bytes" to render the size of a file or image in bytes. Only the numeric value is displayed.

  • Use format="size_KB" to render the size of a file or image in kilobytes. Only the numeric value is displayed.

  • Use format="size_MB" to render the size of a file or image in megabytes. Only the numeric value is displayed.

When referencing a link component:

Use format="url" to render the full URL of a link component.

For example:

/wps/wcm/myconnect/Library/Site/SiteArea/Content

Use format="path" to only render the site path of a link component.

For example:

/Library/Site/SiteArea/Content

Use format="tag" to render a complete link tag. This is used by default if no format is specified.

For example:

<a href="/wps/wcm/myconnect/Library/Site/SiteArea/Content"></a>

The URL generated by the link component will be fully qualified when viewed through a portal. To generate a URL that isn't fully qualified use the "noprefix" option instead:

  • format="noprefixurl"

  • format="noprefixpath"

  • format="noprefixtag"

When referencing number or date elements:

In this case, the format is used to specify the display format of dates and numbers. The following formats can be defined when displaying dates:

  • format="DATE_SHORT"
  • format="DATE_MEDIUM"
  • format="DATE_LONG"
  • format="DATE_FULL"
  • format="DATE_TIME_SHORT"
  • format="DATE_TIME_MEDIUM"
  • format="DATE_TIME_LONG"
  • format="DATE_TIME_FULL"
  • format="TIME_SHORT"
  • format="TIME_MEDIUM"
  • format="TIME_LONG"
  • format="TIME_FULL"
  • format="relative" ("today", "yesterday" or the number of days ago.)

You can also set user-defined formats for both dates and numbers.

When referencing user details:

When formatting user details, the format parameter is used to define which LDAP parameter to use when displaying user details.

For example:

  • format="cn" is used to display the common name.
  • format="dn" is used to display the distinguished name.

Maximum character length:

You can also specify a maximum number of characters to display by using this format:

    format="length:number_of_characters"

For example, to display a maximum of ten characters you would specify the following parameter:

    format="length:10"
compute=" " Applicable to menu, navigator and taxonomy components.

Specify compute="always" when referencing JSP code within a component design, and you want that code to be run separately on each result returned by a menu, navigator and taxonomy component.

For example, if a menu referenced JSP code that used the public DocumentId getCurrentResultId(); method, you would use compute="always" to make the JSP code run separately in every result returned by the menu.

If not specified, then compute="once" is used which is the default method for delivering the results of menu, navigator and taxonomy components.

htmlencode=" " If htmlencode="true" the reserved HTML characters in text and short text components will be converted into character entities.

For example, '<' will be converted to '&lt;'. This is useful if you would like to prevent users adding malicious code, or if you want to prevent users changing the look and feel of their text using HTML. If not specified, the default setting specified in WCMConfigService.properties. By default, this is set to "true":

cmpnt.htmlEncodeDefault=true
awareness=" " If awareness="true" then user names are displayed using the people awareness features.

These features displays user names as hyperlinks that allow users to contact people with whom they might want to work. Wherever person links appear, users can click the link to display a menu of actions for collaborating (contacting and working) with the person named by the link. If you, as administrator, have also configured an IBM Lotus Sametime server to work with WebSphere Portal, person links indicate whether a person is active, away, offline, or in a Do Not Disturb state.

People awareness will only work in content rendered using either a local or remote rendering portlet.

If not specified, then awareness="false" and people awareness is not used.

separator=" " Used when referencing a user selection component. Defines what text or code will be rendered between each selection.

For example, to add a line break between each selection, you would use separator="<br>" . If not defined, a comma will be placed between each selection when rendered.

/> Closes the tag.


Parent topic:

Creating Web content tags