Farcry: Know your tag libraries - skin:buildLink

One of the tag library tags I use the most is skin:buildLink

This one you use to build links to any of the objects (articles, news, images etc.) within your application. All you need is the objectID. Let's say that you are showing a teaser, and want to link to the full article from a read more link.

You'd do this (abreviated):

<!--- tag libraries --->
<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />

<!--- the teaser --->
<cfoutput>
<h3>#stObj.title#</h3>
#stObj.teaser#<br />
</cfoutput>
<skin:buildLink objectid="#stObj.objectid#">
<cfoutput>
Read More
</cfoutput>
</skin:buildLink>

Notice that you escape cfoutput before calling the tag - this as part of limiting white space.

Very handy to know - especially if your site uses FUs

Happy Farcry'ing

Comments
What about parameters?

If we have parameters on link such as &pagename=123&language=en_us
# Posted By Jack | 5/14/07 11:52 AM
@Trond

Yep, the buildLink tag sure is a thing of beauty!

@Jack

The buildLink tags also takes a few nice args that let you manage other params etc.

* The stParameters arg will allow you to supply a struct that will be used to create the extra URL params
* Also the xCode arg will let you add other attributes to the (a) link tag (good for titles etc).

cheers

David
# Posted By djw | 5/14/07 10:39 PM