ColdMVC

Assets

ColdMVC provides an easy way to work with your application's public assets, including images, CSS files, and JavaScript files.

Images

Images will be located inside your application's /public/images/ directory.

There are a few ways to render images. The easiest way is to use the image tag:

<c:image name="logo.gif" />

Another method is to use the renderImage view helper:

#renderImage("logo.gif")#

Finally, you can also use the linkToImage view helper to display just the URL to the image.

<img src="#linkToImage("logo.gif")# alt="" />

The previous three examples all output equivalent HTML.

JavaScript

JavaScript files will be located inside your application's /public/js/ directory.

There are a few ways to render links to JavaScript files. The easiest way is to use the script tag:

<c:script name="jquery.js" />

Another method is to use the renderJS view helper:

#renderJS("jquery.js")#

Finally, you can also use the linkToJS view helper to display just the URL to the JavaScript file.

<script src="#linkToJS("jquery.js")#" type="text/javascript"></script>

The previous three examples all output equivalent HTML.

CSS

Cascading stylesheets, or CSS files, will be located inside your application's /public/css/ directory.

There are a few ways to render links to CSS files. The easiest way is to use the style tag:

<c:style name="style.css" />

Another method is to use the renderCSS view helper:

#renderCSS("style.css")#

Finally, you can also use the linkToCSS view helper to display just the URL to the CSS file.

<link href="#linkToCSS("style.css")#" type="text/css" rel="stylesheet" />

The previous three examples all output equivalent HTML.