Page link (pageref)¶
Attribute options¶
Option | Description |
---|---|
Link | The default value of the attribute (link) |
Allow external links | Switch allows to set external links. If it is off, the edit links dialog in the page management UI allows to specify only links to ηCMS pages. |
Edit mode¶
Press the link button to select a target page for a link, edit link title or enter an external link.
Using in the markup¶
Type of attribute value: com.softmotions.ncms.mhttl.RichRef
Properties of RichRef:
Property | Description |
---|---|
link | Link URL |
name | Link Name |
toHtmlLink() | Create an html link |
Generating links using the toHtmlLink() method:
#set(RichRef link = asm('pageref'))
$!{link.toHtmlLink(['class':'active'])}
This example creates a <a> link to the selected page with an additional attribute class =”active”.
Alternative example:
#set(RichRef link = asm('pageref'))
<a href="$!{link.link}" class="active">$!{link.name}</a>
com.softmotions.ncms.mhttl.RichRef objects can be used
with linkHtml()
method to create html links
An example of a link creation:
$!{linkHtml(asm('pageref'), ['class':'active'])}