Create an element tag

The Element tag is used to reference an element within a presentation template or element design.

This is the format of an element tag:

 [Element type=" " context=" " name=" " key=" " format=" " link=" " separator=" "
htmlencode=" " awareness=" " start=" " end=" " ]

To create an element tag:

  1. Click Insert a Tag from a presentation template or element design field. The Tag Helper dialog opens.

  2. Select Element as the tag type.

  3. Select a source item type. This is added to the tag as the type=" " parameter:

      Content

      • Use this option to display an element from the current content item.

      Parent

      • Use this option to display an element from the parent site area of the current content item

      Top

      • Use this option to display an element from the top site area in the current path of the current content item.

  4. Select the context of the item to retrieve the element from. This is added to the tag as the context=" " parameter:

      Selected

      • Select a specific site area or content item. You must then add the name of the item being referenced using the name=" " parameter. You can select an item by clicking Select.

      Current

      • Use this option to reference the element from the current site area or content item.

      AutoFill

      • Use this option when the element being referenced is determined by the search parameters of a menu, navigator, or taxonomy component. If the tag is not used within a menu, navigator, or taxonomy component, the context will revert to the current item.

      1. If you select Selected, click the Select button to select a specific site area or content item.

  5. Click Select authoring template to select an appropriate authoring template. Select the element to display from the list of available elements. This is added to the tag as the key=" " parameter:

  6. Click OK to add the tag to design.

Once you have added the tag to design, you can also add the following parameters to the tag:

Table 1. Additional tag parameters

Tag parameters Details
name=" " If you specify name="./itemName", the actual path is not resolved until the item is rendered. This takes slightly longer to resolve than specifying the path to the item.
format=" " Optional and can only be used with some element types:

When referencing an image element:

  • Use format="url" to only render the URL of an image element.

  • Use format="tag" to render a complete image tag. The image is displayed on the rendered page. This is used by default if no format is specified.

  • Use format="height" to only render the height of an image element.

  • Use format="width" to only render the width of an image element.

  • Use format="alt" to only render the alt text of an image element.

When referencing a link element:

    Use format="url" to render the full URL of a link element. For example:

    • /wps/wcm/myconnect/Library/SiteArea/Content

    Use format="path" to only render the site path of a link element. For example:

    • /Library/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/SiteArea/Content"></a>

      Note: The URL generated by the link element is fully qualified when viewed through a portal. To generate a URL that is not fully qualified use the "noprefix" option instead:

      • format="noprefixurl"

      • format="noprefixpath"

      • format="noprefixtag"

When referencing a file resource element:

    If 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 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 you need to test them first.

      Maximum Cache Size:

      If the converted HTML is larger than the default cache size defined by the resourceserver.maxCacheObjectSize property in the WCM WCMConfigService service, each request that contains this file is 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, you should ensure that 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 elements:

  • Use format="mimetype" to render the mime type of a file or image. If no valid mime type can be determined then "www/unknown" is 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 than 1K, then the size in bytes is rendered. If the size of the resource is less than 1MB, then the size in kilobytes is rendered. If the size is greater than or equal to 1MB, then the size is 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 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" (The relative date is displayed as either "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"

link=" " The link parameter is used to define the type of link created by the element tag:

link="default"

    A standard link to an element is created.

link="path"

    Contextual path linking is used when rendering this element.

link="contextual"

    Contextual content linking is used when rendering this element. If not applicable, then contextual path linking is used.

Contextual linking:

Contextual linking is used so that when content is linked from another site, the link is rendered relative to the current site if possible. It can only be used if context=current or context=autofill.

separator=" " This is used when referencing an option selection or user selection element. It is used to define what text or code is rendered between each selection displayed in an option selection or user selection element. For example, to add a line break between each selection, you would use separator="<br>". If not defined, a comma is placed between each selection when rendered.
htmlencode=" " If htmlencode="true" the reserved HTML characters in text, short text and option selection elements are converted into character entities. For example, '<' is 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 by the cmpnt.htmlEncodeDefault property in the WCM WCMConfigService service is used. By default, this property is set to true.

awareness=" " If awareness="true" then user names are displayed using the people awareness features. These features display 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 only works in content rendered using either a local or remote rendering portlet.

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

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.


Create web content tags

Related tasks

Set service configuration properties

January 17, 2012 by John James      

 

Apr 1, 2011 1:26:17 PM

});


+

Search Tips   |   Advanced Search