Plugin Link/Path/URL Function linkToItemAnchor()

public final function linkToItemAnchor(
$cID, $cType = 'html', $fullPath = false, $request = '', $alias = false, $autoAddImportantRequests = false, $useAliasInAdminMode = false


Generates attributes for a hyperlink to a Content Item.

Where You Can Use It

Can be used in methods called by plugins. From Zenario 7.0.0 onwards.


An alternate version of the linkToItem() function, this provides you with a link suitable for placing in a Merge Field for a Theme Template.



The Content id of the Item to link to. If it's a html Content Item you can provide an alias instead.


The Content Type of the Item to link to. Defaults to html.


Whether to use a full URL rather than a relative URL.


A string of URL requests, in the format:



From version 6.0, you can enter the alias of the Content Item if you know it.

If you don't provide this parameter (or in versions of the CMS prior to 6.0) the alias will be automatically looked up.


(From 6.0.5)

If this is a link to the current Content Item, set this to include any requests added using the registerGetRequest() function.

Has no effect if linking to a different Content Item.


(From 6.0.5)

Set this to force use of the alias and friendly URLs in Admin mode.


When generating full URLs, you can set this variable to set the HTTP HOST.

By default, the $_SERVER['HTTP_HOST'] variable or the site's primary domain will be used.

Return Value

The HTML attributes needed for the link.


$this->mergeFields['Homepage_Anchor'] =
<a [cms:merge name='Homepage_Anchor'/]>[cms:phrase code='_HOME'/]</a>

This example illustrates how to put a link to the homepage on a theme.