webCOMAND

#LINK

Syntax

#LINK($procedure, $object = '', $publication = '')

Parameters

  • procedure - Identifier of the Publication Procedure that produces the file to link to.
  • object - Optional key or field=value pair to uniquely identify the object in a Publication Procedure List to link to. If a single value is provided, it will be matched against the first Unique/Key field of the content type (or the OID if no Unique/Key field exists). If a field=value pair is given, the specified Unique/Key field of the corresponding content type will be matched to the specified value.
  • publication - Optional Publication, which may be identified with a:
    • Identifier - Link to the publication with a matching Identifier.
    • field=value - Link to the publication where the publication field matches a unique value.
    • cPath - Any cPath that evaluates to one or more Publications.  The first match will be used.  The cPath can include all of the usual clauses, including ORDER BY and WITH.

Description

#LINK outputs a URL referencing the file produced by the specified Publication Procedure.  If a Publication Procedure is based on a Publication List (a Publication List is selected for the List field), then a Unique Value must be specified to indicate the specific file in the list to link.

If the Publication List's Content Type has no Unique/Key fields, the Unique Field can be skipped and the OID used for the Unique Value. If a Content Type has only one Unique/Key field, the Unique Field can be skipped and the Unique/Key field value used.

A relative URL will be output by default, but #PATHTYPE can be used to produce absolute and rooted URLs.  #PATHTO and #PATHFROM can also be used to adjust the URL.

Related

#PATHTYPE, #PATHTO, and #PATHFROM.

Example - Procedure-Only

Create a relative link to the Home page produced by a Publication Procedure named "Home".

<a href="#LINK(Home)">Home</a>

Example - Procedure and Object

Create a relative link to the Home Web Page produced by a Publication Procedure named "Web Page" with a List that includes a web page with the Key "Home".

<a href="#LINK(WebPage, Home)">Home</a>

Example - Procedure, Object and Publication

Create an full URL link to the Book1 page produced by a Publication Procedure named "Product" with a List that includes a product with the Key "Book" in the StoreStaging or StoreLive publication.

<a href="#LINK(Product, Book, Store)">Buy the Book</a>

Example - Staging or Live Publication

Similar to the example above, but considers whether or not the current publication is a staging publication, and links to the corresponding staging or live store publication.

#NEW($Publication)Store#IF($IsStaging)Staging#ELSELive#ENDIF#ENDNEW
<a href="#LINK(Product, Book, $Publication)">Buy the Book</a>