Plugin Link/Path/URL Function linkToItemJS()

public final function linkToItemJS(
$cID, $cType = 'html', $request = ''


Generates JavaScript code that will redirect the viewer to a different Content Item.

Where You Can Use It

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


This function will return the JavaScript code to a call to the goToItem() JavaScript function.

While you may wish to write this manually, the inputs needed are the same as the linkToItemAnchor() utility function. If you're adding links to a Theme then it is recommended that you call both functions and put the results into two different Merge Fields, so that Theme creators have a choice of which they use.



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.


A string of URL requests, in the format:


Return Value

The JavaScript code needed.


$this->mergeFields['Homepage_JS'] =
<input type="button" onclick="<!--Homepage_JS-->" value="<!--_HOME-->/>

This example illustrates how to direct a visitor to the home page when they click on a button.