Using Snippets

A snippet is a reusable block of text or code. You can create as many as you’d like and reference them by name in your templates and pods. Snippets can include HTML, JavaScript, and Textile code. Note that snippets can include other snippets, which is often useful.

Any time you have a block of text, such as a description of your company, or a piece of code, such as a JavaScript widget, that you want to include in multiple places, you should put it in a snippet, and then just reference the snippet each place you want to use that text or code. By using this approach, you can update the snippet at any time, and all of the places that reference it will automatically have the updated contents.

Each new site comes with a variety of standard snippets that deliver commonly needed chunks of code. These snippets provide standard page components that are typically used in layouts:

Snippet Name Description Where Used
header Header section at the top of the page, including logo and navigation Layouts
kb_inline_search_form Search box top_nav snippet
analytics Google analytics code; account ID pulled from configuration settings Layouts
footer Page footer; includes copyright notice and links to Privacy Policy, About, and Contact Layouts

These snippets provide features for database pages:

Snippet Name Description Where Used
category_navigator Tree navigator for KB categories; requires corresponding CSS and JS links in layout Pod on KB Category and List pages
kb_item_comment_form Displays comment form Pod on KB item pages

These snippets are used automatically by the system:

Snippet Name Description Where Used
pod_frame Round-cornered pod surround; uses theme images and styling in pod.css Pods that have pod_frame adornment selected
feed_template RSS Feed template Initializes form when creating an XML feed
activation_initial New user activation message Message sent to new user when you create one
activation_reset Reset password message Message sent to user when Reset Password link is clicked
activation_thankyou Thanks you message Message sent to user when activation is successful

Add Your Comments

(not published)

Join our Free Learning Webvanta Course

We'll send you a series of brief lessons and tips on making the most of Webvanta. In less than a month you'll be an expert at building powerful, database-driven sites.

Name:
Email:

We hate spam as much as you do. We'll use your address only for sending you this course and Webvanta updates.

Related Articles