2020.2

Table Of Contents
var json_data = loadjson("snippets/snippet.json");
results.html(json_data.field1);
See also: "Writing your own scripts" on page853.
For an example in which JSON snippets are being used to localize a template, see this how-to:
Localizing templates using json.
Adding a snippet to the Resources
Before adding a snippet:
l Import the resource files that are related to the snippet, such as image files and CSS files,
into the template file. Drag and drop the files to the corresponding folders (Images and
Stylesheets, respectively) on the Resources pane. If you want to use external images,
see "Images" on page708.
l
Drag the snippet itself to the Snippets folder on the Resources pane, or create a new
snippet from an existing piece of content in the template (see "Creating a snippet" on the
facing page).
Remote snippets
A remote snippet is an HTML file that is not located within your template file but is hosted on a
Content Management System or other external location.
To add a remote snippet:
1.
Right-click the Snippets folder on the Resources pane, and click New Remote Snippet.
2. Enter a name for the file as it appears in the Snippets folder. This name is shown in the
Snippets folder with the .rhtml file extension.
3. Enter the URL for the remote resource. This must be a full URL, including the http:// or
https:// prefix, domain name, path and file name.
Note
Remote snippets may contain other resources, such as images. There is one limitation
though: only absolute paths are supported inside remote snippets. Images and other
Page 723