Documentation >> Macros >> linkResource
Macro: linkResource
Usage:
<!--#linkResource rezId="[resource id]"-->
Overview:
Returns a link expanded from the original resource.
The difference between this macro and just using the |resource| itself is that the macro allows all of the attributes in the resource to be overridden (except for the URL the resource points to). The most common use for this resource is to use different text (in the link) than would be inserted by resource itself.
Required Attributes:
Optional Attributes:
The rest of these optional attributes are exactly the same as the names of the attributes visible in the resource editor. They simply create attributes in the <A> tag that is created by expanding the resource. You can read more about these attributes in the W3C documentation.
- title
- target
- class
- style
- onclick
- ondblclick
- onmousedown
- onmouseup
- onmouseover
- onmousemove
- onmouseout
- onfocus
- onblur
- onkeypress
- onkeydown
- onkeyup
- onselect
- onchange
Examples:
We have a resource named "How To Publish a Web Page" which looks like this after expanding: How To Publish a Web Page
Notice that it's written with "title case" (all significant words are capitalized), and that if you hover your cursor over it the title pops up as a tool tip.
Here's how we'd use the #linkResource macro to change the text of the link. Just for kicks, we're going to add something for the onClick event, and we're going to remove the title by setting it to the empty string.
<!--#linkResource rezId="How To Publish a Web Page" text="Publish!" title="" onclick="return confirm('Ready to learn how to publish a message?')"-->
Which is expanded to this: Publish!
View in DG
|