Locating static resources
Woof! may generate links to static resources based on a URL or the name of a local file.
If a fully qualified URL is specified, Woof! generates a link using the URL as is. If the URL is a relative URL, Woof! expects that it is relative to the application root URL and generates the link appropriately.
When linking to a local file, Woof! expects the file to not include any directory components and to be located somewhere under the public directory. Woof! follows a similar procedure for locating static file resources associated with a controller that it does for locating page templates. It will first check for the existence of the file in a directory corresponding to the controller module under a subdirectory of public that is specific to that resource type. If not found there, it will progressively check higher up in the directory path.
Example: locating an image file
Assume the page generation for the controller URL investor_relations/documents/annual_report invokes the command
[my include_image logo.png alt "header logo"]
The URL is mapped to the
controller annual_report
in module
{investor_relations documents}
. Woof! would search for
the file in the following order:
- public/images/investor_relations/documents/logo.png
- → public/images/investor_relations/logo.png
- → public/images/logo.png
Note that because Woof! is looking for an image, the root of the search tree is the images subdirectory under public. If looking for a stylesheet, the root of the search would have been the stylesheets subdirectory.