FarCry tip: displaying teaser images
You find the teaser templates in the folders for the different datatypes in the webskin folder. They all have file names starting with displayTeaser.
As an example lets look at one of the teaser templates for news (slightly abreviated code to save space and focus on the topic): webskin/dmNews/displayTeaserFeature.cfm
<h4><a href="#Application.URL.conjurer#?objectID=#stObj.objectID#">#stObj.title#</a></h4>
<p>#stObj.teaser#</p>
<p>Date published: #dateformat(stObj.PUBLISHDATE,'DD/MM/YY')#</p>
</cfoutput>
Now let us say that we want to display teaser images as well. And we'll have the teaser images float to the right of the teaser text.
First you might want to do a cfdump of the stObj. Here you'll find that there is a value called stObj.teaserimage, but however this is not the name of a image file as you might expect. It holds a UUID for the image object that is the teaser image.
What we will do is use the q4 library that is a part of FarCry to get the necasary information from the image object.
Here's the code:
<cfoutput>
<h4><a href="#Application.URL.conjurer#?objectID=#stObj.objectID#">#stObj.title#</a></h4>
<p>
<cfif len(trim(stObj.teaserimage)) gt 0>
<q4:contentobjectget objectID="#stObj.teaserimage#" r_stobject="getObject">
<cfoutput><img src="/images/#getObject.imagefile#" align="right" alt="#getObject.alt#" /></cfoutput>
</cfif>
#stObj.teaser#</p>
<p>Date published: #dateformat(stObj.PUBLISHDATE,'DD/MM/YY')#</p>
</cfoutput>
At the top we import the q4 library. Then within the paragraph holding the teaser text, we check if there is a UUID value for a teaser image. If so we pass the UUID to a q4 method called contentobjectget. We then get all the needed properties of the image object back. Here we use imagefile and alt, but you can try to cfdump getObject to see all properties available.
Now you have no excuse for not getting some more pictures into your FarCry solutions ;)
Happy FarCry'ing


------
<cfsetting enablecfoutputonly="yes">
<!--- @@displayname: Someteasertemplate --->
<cfimport taglib="/farcry/farcry_core/tags/webskin" prefix="skin" />
<cfimport taglib="/farcry/farcry_core/tags/widgets" prefix="widge" />
<widge:imageDisplay objectid="#stObj.teaserImage#" alt="#stObj.title#" ImageSize="thumb" />
<cfoutput>
<h3>
</cfoutput>
<skin:buildLink objectid="#stObj.objectid#"><cfoutput>#stObj.Title#</cfoutput></skin:buildLink>
<cfoutput>
</h3>
<p>
#stObj.Teaser# </cfoutput>
<skin:buildLink objectid="#stObj.objectid#"><cfoutput>ᄏ Read more</cfoutput></skin:buildLink>
<cfoutput>
</p>
</cfoutput>
<cfsetting enablecfoutputonly="no">
The way you propose is probably more "pure" FarCry, but without further investigation (and a chance of making a fool of my self - as so many times before) I see at least one little practical difference, and that is that with the widget we don't get full access to the whole image object, and therefor it's slightly limited what we want to do with it. In my example it's the images alt text being used, while in your example the alt text will be the subject of the article it belongs to.
One of the good things with FarCry is that there is many ways to achieve similar result. The challenge is to learn them, and decide on which one fits best for the situation.
PS - Jrgen is a colleague and friend of mine whose knowledge and insight about FarCry surpasses mine by a mile, and if he says something about FarCry I usually listens without argument.