
Select
Components User's Guide
113
illustrated above. When you deploy the site, your choice of deploy map automatically
determines which version will actually be output to the web server.
Select Example 2: Displaying Unique
Content at Preview Time
Collage includes a project setting which allows you to retrieve the metadata value for a
specified deploy map when you preview an asset. Because the Select component can
display unique content based on metadata values for the deploy map that is used to
deploy the asset that contains this component, this project setting allows you to take this
even further: you can also use the Select component to display unique content based on
the metadata values for the deploy map specified in this setting.
For example, you might use this to display status or author information when previewing
pages, such as: "This page was created by Stanley Mar on 2/6/03."
The table below describes an example implementation of this:
Step Description
1
Create a deploy map called PreviewMap which will be used exclusively to
display content from the Select component on previewed pages. See the
Serena Collage Project Manager's Guide to learn how to set up deploy
maps.
2
Define a custom boolean metadata field for the project called Preview.
Associate the metadata with the Deploy Map asset type. See the Serena
Collage Project Manager's Guide to learn how to set up metadata fields.
3
For the PreviewMap deploy map, Set the Preview metadata field to Yes.
4
Set the
Deploy Map to get metadata from during preview
project
property to the PreviewMap deploy map. Then, whenever assets are
previewed, Collage will load the Yes value for the Preview metadata field.
5
Check out any asset that you want to display the unique content at preview
time and add the following Select component to it:
<nexus:component classid="nexus/components/
Select"
code="$nexusComponents"
select="$publishmap.meta('Preview')">
<nexus:select "1">
<p>This page was created by $node.creator
on $node.createdate("MM.d.yy"). The
file was last modified on
$node.filedate("MM.d.yy").</p>
</nexus:select>
<nexus:select "0">
</nexus:select>
</nexus:component>
Uses the Preview
on the deploy
Text will display when
Preview is set to 1 ("Yes")
Nothing will
display when
set to 0 ("No")
Preview is
Text includes
macros to
display the
author's name,
the create
date, and the
last modified
date
map
Kommentare zu diesen Handbüchern