Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleReloading/Restarting The Application To Recognise Webskin Changes

When a FarCry application starts it works out all the available webskins for every content type and stores them in memory. Every time you add a new webskin you need to reload the application in order for the system to recognise it. If you are logged in you can reload the application from the "Tray Menu" or by simply running a page with &updateapp=1 at the end of the URL (if you are logged in).

Alternatively, if you only want to reload part of the application, go into the [ webtop / admin / developer utilities / reload application ] and simply select the options you wish to reload. This is a handy tab to have open at all times while your developing and constantly adding/updating webskins and metadata.

Tip

Changing webskins does NOT require an application restart. You only need to restart if you are adding, removing or renaming webskin files.

Naming Webskin Templates

Although you can give your webskin template any file name, in practise it makes sense to follow the naming standards used by the rest of the community. The following table outlines common naming prefixes for templates and explains their uses within the FarCry framework. An asterisk (*) denotes a wildcard, where you would use your own unique name to differentiate templates of similar purpose.

Template Name

Purpose

Examples

display*

General prefix for all display templates. By default FarCry allows anonymous users to view anything prefixed with display*

displayPage*

A full page template display, typically incorporating header and footer HTML, and designating the entire page layout. These templates are available by default in the content editing wizards for contributors in community plugins, such as FarCry CMS.

./dmHTML/displayPageHome.cfm

displayPageStandard.cfm

In the absence of any additional criteria, FarCry will attempt to display a content object item with this template, assuming it is available. It is in effect the "standard" full page template view.

displayTeaser*

A teaser view such as a title and short copy with a link to the full page view. Often used for listing other content objects on a page. Automatically recognised by many publishing rules.

./dmHTML/displayTeaserFeature.cfm

displayTeaserStandard.cfm

Similar to displayPageStandard, in that if no other criteria is given the framework will attempt to render a given content object with this template, assuming it is available and a teaser view is required.

displaySearchResult.cfm

Used in the farcryverity plugin search plugins to provide a universal search result teaser. As individual content types might be better suited to different teasers you can provide your own as needed.

edit*

General prefix for editing a content type. ./dmProfile/By default, these views are secured to content publishers only and are not accessible by anonymous users.

./dmProfile/editOwnProfile.cfm

edit.cfm

Default edit handler. Typically this is not present, at least in simple content types, as the framework will automatically build edit handlers from the formtool metadata. However, like most things in FarCry you can override this as needed.

These are just a few of the regularly used webskin names within the FarCry framework. For a complete list of reserved webskin template names review: https://farcry.jira.com/wiki/display/FCDEV50/Webskin+Templates

Hooking Up The Webskin To Data

Every time a webskin is invoked it is done so in the context of a specific content objecttype.

For example, viewing a particular news article in with a displayPageStandard, or a product item with displayPageProduct.cfm, or whatever. FarCry always provides the entire content object item record to the webskin (or view) as a structure called stobj.

stobj contains the typename, and all the property keys and values for the object in question, including array properties.

Tip
titleArray Properties

Array properties are automatically generated provided as an actually a CF array in the structure value field. The array contains all the related object references as UUID values. More on this later.

The data contained in the stobj structure can be referenced in the normal wayas a simple ColdFusion variable, and then combined with mark-up to produce the desired output. The similarity between this and any normal procedural ColdFusion template is deliberate - the framework authors have tried hard to make the creation of webskins or views very similar to building a simple ColdFusion template.

Code Block
titleSimple Example of a News Template
<cfsetting enablecfoutputonly="true">
<!--- // Dead Simple Example Webskin Template -- Dead Simple --->
<cfoutput>
  <h1>#stobj.title#</h1>
  #stobj.body#
</cfoutput>
<cfsetting enablecfoutputonly="false">
Tip
titleWhitespace Management

FarCry best practice sets <cfsetting enablecfoutputonly="true" /> at the top of your webskin and <cfsetting enablecfoutputonly="false" /> at the bottom. This means simply that any content you want displayed must appear between <cfoutput></cfoutput> tags. Try to avoid putting custom tags within <cfoutput> - without special treatment (eg. using cfsilent internally) the custom tag will output all its contents as whitespace.

...