BASICS

ADMINISTRATION

DEVELOPMENT

SUPER ADMIN

  LAST UPDATED
4/8/2014

Configuring Snippets

Available to Level 10 and Site Specific

Overview

Snippets are reusable files. The snippets feature must be enabled for a customized WYSIWYG toolbar, the content defined in individual files, categories added with the snippet manager, and snippet files added to categories. Snippets and snippet categories can also be edited and deleted. From an administrator standpoint, snippet source files can also be edited at any time, but this does not affect content that was created by inserting a snippet file. The difference between a snippet and an asset is that an asset can be edited once and changes are applied to all subscribed pages. This is not the case with snippets.

After configuration, snippets can then be utilized by users. End-users insert a snippet on a page by selecting the Snippet icon on the WYSIWYG toolbar, then a category and a snippet from it. If necessary, they can edit it.

One way to use snippets is to create a reusable table structure. While the table data is expected to change from page-to-page, the table structure can be defined by the snippet file. Other examples include a predefined form, an image with a caption, and frequently used text such as contact information. Directory variables can be used within a snippet. Variables that are resolved at the time the snippet is inserted into the page and can customize the information based on location.

Example of Snippet

Selecting a Table Snippet

 

Next Page

 

Enabling Snippets

Snippets can be enabled for a custom WYSIWYG toolbar. 

1. Navigate to Setup > Toolbars.

2. Click Edit to edit a toolbar and select the checkbox for the Snippets icon.

Snippets Icon

Snippets Setup for WYSIWYG Toolbar

 

Previous PageNext Page

  

Creating Snippet Files

The extensions .inc, .html, and .txt are all valid extensions for snippet files. Snippets should never include server-side (e.g., ASP.Net, PHP, or ColdFusion) or client-side code (JavaScript) because the WYSIWYG Editor will strip it out. Snippet files can be HTML-based or text. It is possible to include classes that are called by client-side and server-side code, however.

In order to manage snippet files easily, it is suggested that there be one folder where all snippet files are uploaded. For example, _resources/snippets. This folder is generally restricted to administrators, and users should be encouraged to send the administrator the snippet files they wish to use so the administrator may for review, upload, and assignment.

When creating a snippet that contains an image, use the full path to the production server to be able to preview the image in the Snippet Preview window before inserting it on the page. When creating snippets containing Flash or other Multi-Editor supported media do not use the IE browser as different versions of IE could produce unexpected results in the Multi-Editor.

Source View of an Example Snippet File with HTML Formatting

Snippet File Code View

 Source View of an Example Inc File Used as a Snippet

Snippet File Example

 

Previous PageNext Page

  

Defining Categories and Snippets

Categories can be added and snippets organized within them.

1. Navigate to Setup > Snippets.

2. Under Categories, click Add.

Categories & Snippets

 

3. Give the new category a friendly name, which will help end-users determine where the snippet is located.

Categories Definition

4. Click Done.

5. Under the Snippets list, click Add. It is also possible to select an existing category and add snippets to it.

Snippet Definition

6. From the Snippet Definition screen, give the snippet a friendly name. This will help users determine which snippet to use.
7. Click Browse and select the file to be used. Typically, snippets are located in the snippets folder within _resources.
8. Add a Description if desired, which is displayed as a message to users inserting the snippet
9. Click Done.

10. Click Submit to save changes.

The Snippet screen will look the same whether Submit has been clicked or not. Be sure to click Submit to save any changes.

Modifying or Deleting Snippets

Snippets and snippet categories can be modified and deleted. Modifying a snippet is similar to adding one but instead of using the Add button, use the Edit button. Keep in mind that simply clicking on a category so that it is highlighted displays the Snippets associated with it. If the Snippet itself needs to be modified, rather than the category name, there is no need to click on Edit under the category name.

Deleting a snippet does not delete it on any pages on which it might have been placed. It only deletes the Snippet from the options when the Insert Snippet icon is used in the WYSIWYG Editor. To delete a snippet:

1. Select the snippet.

2. Click the Delete button. The system will not ask to confirm the deletion. If the deletion should not have taken place, click the Cancel button at the bottom of the screen. Keep in mind that deleting a category deletes all of the snippets within that category.

3. Click Submit. Note that this does not delete the snippet file itself.

 

Previous PageNext Page

 

Using Variables with Snippets

Directory variables can be used within snippets; for example, to customize the information based on the location within the system. In this case, one would define a variable property name (e.g., "department") to be used for the directory variable and for within the snippet. The value of the "department" property name can be defined for each directory. When the snippet with the variable is used within any file under the directory, the value defined for that directory will be pulled in with the snippet. So, if there is a directory for admissions and a directory for academics, the department property can have values of admissions and academics, respectively.

Configuring Directory Variables

1. Click the Access Settings icon for a directory from the Content > Pages view.

2. From the Directory Variables section > Properties for This Folder, create a new property and define the name for the property and the value for the property.

Directory Variable Example

3. Click Save.

Using the Directory Variable in a Snippet

1. Create the snippet file.

2. Add the defined name for the directory variable using the following syntax:

{$department}

And within the snippet file for example:

Information for the admissions department: <a href="http://newgallena.edu/{$department}>newgallena.edu/{$department}</a>

When inserting the snippet in any files below the directory that has variables defined, the variables will be resolved to the definition for that directory.

 

Previous Page

 


Was this page helpful?

Additional Comments:


(Include your email address if you would like a reply)

Procede to http://support.omniupdate.com/