What are snippets you ask? Just a little something I came up with to make my life and the lives of my clients easier.
DISCLAIMER: I set this up using FC 3.0.2. I do not know how it may function on FC 4.
I have set up a lot of sites that have little random pieces of content here and there. Usually I end up making a custom rule or sometimes a custom type to handle each piece of content. Bigger sites, however will end up with several custom pieces, each of which requires the client to do things just right.
Let’s face it, remembering a password is hard enough for some people, let alone managing multiple containers each with a different content type. My solution? Snippets.
A snippet is a data type (jcSnippet) that is similar to a dmNews object only stripped down. The most important piece is the body and the use of the WYSIWYG editor and the image/file/link inserters. The link inserter is also custom. You can see other posts about it on my blog.
Essentially what will happen is the user will create a snippet (some HTML) that will get dumped into a container. This will allow the users to completely customize container content when necessary using the WYSIWYG editor of your choice.
The files necessary for Snippets can be downloaded at Farcry Snippets.
INSTRUCTIONS:
- Upzip the snippets.zip file to your project folder
- Go to Admin -> COAPI Management -> Type Classes / Rule Classes to deploy all new types/rules
- Add the following code to your customadmin.xml file:
<webtop>
<section id="content" mergetype="merge" permission="MainNavContentTab" label="application.adminBundle[session.dmProfile.locale].content" labelType="evaluate">
<subsection id="dynamic" mergetype="merge" label="application.adminBundle[session.dmProfile.locale].DynamicContent" labelType="evaluate" sidebar="content/sidebar.cfm" content="inc/content_overview.html">
<menu id="ContentType" label="application.adminBundle[session.dmProfile.locale].ContentType" labelType="evaluate">
<menuitem id="listjcSnippet" label="Snippets" link="/admin/customadmin.cfm?module=content/jcSnippet.cfm"></menuitem>
</menu>
</subsection>
</section>
</webtop>
USAGE:
- Go to Content -> Snippets (under Dynamic Content)
- Add a snippet (nothing more than a little piece of HTML created using the WYSIWYG editor)
- Approve the Snippet when satisfied
- Click View on the top right or browse to your site
- Click Show Design in the admin menu
- Edit a container and add the “HTML Snippet” rule. On the content tab you can select the snippet that you just created.
That’s all there is to it. Fully customizable HTML snippets implementable in any container.

Related Articles
No user responded in this post
Leave A Reply