plainblack.com
Username Password
search
Bookmark and Share

Snippet

The snippet allows you to reuse text throughout your site. Snippets can be anything from plain text, HTML, CSS, or Javascript. Unlike other assets, Snippets don't have templates associated with them. They are merely what you tell them to be. Place content in the Snippet, and when you need to update the text do it once in the snippet. The update will automatically occur anywhere on the site where the snippet is referenced.

Snippets are useful if you have frequently used content, such as legal disclaimers or copyright information, that must appear on every page on the site. Instead of placing an asset that displays that text everywhere on the site, make one Snippet asset and simply reference the Snippet through a macro on every page. Snippets can also be used to pull in HTML. For example, if you have a video stored on an external site, such as YouTube®, you can copy the HTML to embed that video, paste it in a Snippet asset, and then reference the Snippet through ^AssetProxy(); on the site. The macro will pull in the Snippet and display the video on the page.

The WebGUI Designers Guide contains more information about using Snippets.

  1. Select the Snippet asset from the New Content menu of the Admin Bar.

  2. The “ Snippet, Add/Edit” screen will open.

 

  1. Enter a title for the snippet in the “Title” field. Make sure your title gives you some kind of indication of the snippet’s purpose.

  2. The “Menu Title” is the asset’s title as it appears in the navigation. You can leave this blank and WebGUI will fill it in for you (by default WebGUI will use the “Title”).

  3. The “URL” field can also be left blank and WebGUI will fill it in for you (for the purpose of this example it was filled in as “snippet”).

  4. In the “Snippet” field enter the snippet text. Again, this can be anything (for this example text was wrapped in a HTML heading tag).

  5. Near the bottom of the screen is the “Process as template?” field. If toggled to Yes, the snippet will be processed as a template by WebGUI, which will allow you to use session variables in the snippet.

  6. Select the “MIME Type” to specify the MIME type when the snippet is viewed over the web.

 

  1. Select your display settings from the “Display” tab. These are the standard Display settings common amongst most assets.

  1. Select your security settings from the “Security” tab. These are the standard Security settings common amongst most assets.

  1. The Metadata tab is the standard Metadata screen common amongst all assets. If you need to handle metadata for the purposes of content profiling you can do so here.

  1. When all settings are complete, click save. Your snippet will appear on the page.

 

The HTML was processed, so the text has the properties of a heading. The snippet can be placed throughout the site, so if changes are made to it the changes will appear anywhere the snippet is referenced.

Reference a Snippet

  1. Click the Edit tab of the asset toolbar for the asset in which you would like to reference the snippet. This could be an Article, a Folder, a Page Layout, etc. The Edit screen for the asset will open.

  2. In the “Description” field, reference the Snippet via the AssetProxy macro. This is either:  

    • ^AssetProxy(URL); : enter the Snippet asset's URL between the parentheses.

    • ^AssetProxy(assetID,1); : enter the Snippet asset's asset ID between the parentheses. This option might be best if you are worried that the Snippet's URL will change for some reason.

  1. Click save, and the Snippet content will appear in the asset in which it was referenced.

 

Keywords: Assets

Search | Most Popular | Recent Changes | Wiki Home
© 2017 Plain Black Corporation | All Rights Reserved