Versions Compared

Key

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

...

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.

Webskin

...

Decorators

Every template can be supplemented with additional metadata, called a "decorator". You should make a habit of this adding relevant decorators as it makes the whole system read much better, helping to provide human readable template names, inline documentation and so on. Metadata is incorporated by including a series of specific comments at the top of each template.

Name and contact email for the responsible developer.

Attribute

Description

@@displayname:

Human readable display name for the template. Otherwise the framework will display the filename instead.

@@description:

Longer description about the template's purpose. This can run to any length but is typically a paragraph only.

@@author:

For a complete list of decorators and their uses, see: https://farcry.jira.com/wiki/display/FCDEV60/Summary+of+View+Decorators

Template metadata is always stored in a ColdFusion comment.

On initialisation, FarCry scans the registered webskins for their additional metadata and stores it in memory. If you make a change to the metadata you may need to re-start the application in order to see the change come into effect.

Code Block
titleSample Metadata Attached With Decorators
<!--- @@displayname: Core Home Page --->
<!--- @@description: Home page for the FarCry Core developer portal. --->
<!--- @@author: Matthew Bryant (mbryant@daemon.com.au)@@Cachestatus: 1 --->
<!--- @@Cachetimeout: 60 --->
<!--- @@Fualias: home --->

Walkthrough: Create displayPageSuper.cfm

...

  1. Locate the ./webskin/dmHTML folder in your project
  2. Create a file called displayPageSuper.cfm
  3. Write up some basic HTML in a <cfoutput> code
    Code Block
    title./webroot/farcry/projects/myproject/webskin/dmHTML/displayPageSuper.cfm
    <!--- @@displayname: Demo Template --->
    <cfoutput>
    <h1>Hello Cruel World</h1>
    </cfoutput>
    
  4. Reload the application to pick up the template change. Use the [Reload Application] tool in the webtop.
  5. Select the Site Overview Tab. Edit the FarCry Support HTML page and change its template to the one you just created.
  6. Save and Preview the page. Check the HTML source and discuss with your instructor.
  7. Edit your template and add a cfdump to the page for stobj
    Code Block
    <cfdump var="#stobj#" label="Content Object" />
    
  8. Save and preview the page.

...

FarCry has a special custom tag library dedicated to making life easier when building webskins. In includes all sorts of goodies from building navigation, to breadcrumbs, to rendering other views and more. You can find this library in the core framework at: ./core/tags/webskin To make use of these tags you will need to import them first.

For a complete list of webskin tags see: http://docs.farcrycore.org/p600/

Code Block
titleImporting Custom Tag Libraries
<!--- @@displayname: Home Page --->
<!--- @@author: Matthew Bryant (mbryant@daemon.com.au)--->

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

<!--- breadcrumb; detects position in the site tree and builds a breadcrumb --->
<skin:breadcrumb />
Tip
titleProject Tag Libraries

We recommend creating your own custom tag libraries under the project folder and importing them in the same way: ./myproject/tags/mytaglibrary

...