Template and Widget FAQ

Answers to common questions about creating your own templates and widgets.

Why are the supplied templates named with _xhtml?

AssetNow NX can perform content negotiation and send pages including the <xml> header prefix to web browsers that support this. Unfortunately Microsoft Internet Explorer displays content differently when encountering this prefix. When a template is named with the _xhtml suffix and if xhtml is set in the ALLOW_DISPLAY_TYPES configuration parameter AssetNow NX will serve the XHTML 1.0 strict to most browsers and transitional (without the xml prefix) to Internet Explorer.

For most site implementations, and if you do not specifically test on browsers accepting the xml prefix, you do not require the _xhtml suffix and should remove xhtml from the ALLOW_DISPLAY_TYPES parameter.

How do I import widgets into my template?

Add <cfimport prefix="widget" taglib="../../widgets/site"/> at the very top of your template. This will import all widgets in the standard AssetNow site widget directory, you can create other directories and import these using a different prefix.

How can I tell if a page is being cached?

View the page source in your web browser and look for the meta generator tag approximately 10 lines from the top. If the page is cached the tag will include (cached) in the content attribute as follows:

<meta name="generator" content="AssetNow NX 5.0 (Licensee:AssetNow, Type:Developer) template:category/home_xhtml (cached)" />

Note that if you are signed in with Tool access permissions pages will be rendered each time they are requested and not fetched from the cache.

How can I prevent a page from being cached?

Caching can be disabled at a number of levels.

You can disable caching for the entire site by setting the CACHE_CONTENT parameter to No via the System > Tools > Setup > Settings.

You can enable/disable caching for a Category by editing the category and setting Cache = No under the Properties tab. This disables caching for the category page itself and does not affect the content pages contained inside the category.

To disable caching for individual pages set the page Cache = No by editing the page Properties.

My pages do not display some characters correctly?

You should ensure that all your ColdFusion templates are saved with a Unicode Byte Order mark or BOM. The BOM comprises 3 characters is typically not displayed by editors and looks like this . The BOM tells the ColdFusion complier to process a template as Unicode and so all characters will be processed correctly. You should always save any ColdFusion templates with a UTF-8 BOM if this option is available in your editor (Dreamweaver provides this option when saving, Eclipse does not). Alternatively, or in addition to the BOM you can add a complier directive at the top of your templates:

<cfprocessingdirective pageencoding="utf-8"/>

For more information on Internationalization and BOMs see why Adobe recommend using BOMs and Unicode.

How do I add my own stylesheets?

Place your stylesheets in the /css directory. Then edit the headercss.cfm template located in the same directory and add/remove stylesheet references as required.

How do I add my own Javascript to the page header?

Place your scripts in the /js directory. Then edit the headerjs.cfm template located in the same directory and add/remove scripts as required.

What paths do I use to reference images and other resources?

AssetNow NX stores all paths as relative to the root of the installation. A number of paths are available in the ColdFusion application.virtualPaths structure set by AssetNow. you can examine these values via Tools > System > Dump > Application and expand the virtualpaths structure. You should use the appropriate path from this structure. Some of the paths include:

  • ANROOT = path to the site install root
  • IMAGES = path to the /img directory
  • ASSETS = path to the /ass directory
  • STYLES = path to the /css directory
  • SCRIPTS = path to the /js directory

To reference an image named myimage.jpg stored in the /img directory you would use:

<img src="#application.virtualPaths.IMAGES#/myimage.jpg" .../>

We recommended placing your design images and other resources in the appropriate AssetNow directories and using the available virtual path parameters in your code to ensure that your site is not dependent on being installed in a specific location.

Links Referenced
Location

http://www.assetnow.com/index.cfm/1,84,283,0,html

Copyright © Orbital Limited 2010

Learn More        Try It Now!        See Versions and Pricing