...
Tip | ||
---|---|---|
| ||
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.
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: | Name and contact email for the responsible developer.
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 | ||
---|---|---|
| ||
<!--- @@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
...
- Locate the ./webskin/dmHTML folder in your project
- Create a file called displayPageSuper.cfm
- 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>
- Reload the application to pick up the template change. Use the [Reload Application] tool in the webtop.
- Select the Site Overview Tab. Edit the FarCry Support HTML page and change its template to the one you just created.
- Save and Preview the page. Check the HTML source and discuss with your instructor.
- Edit your template and add a cfdump to the page for stobj
Code Block <cfdump var="#stobj#" label="Content Object" />
- 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 | ||
---|---|---|
| ||
<!--- @@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 | ||
---|---|---|
| ||
We recommend creating your own custom tag libraries under the project folder and importing them in the same way: ./myproject/tags/mytaglibrary |
...