Home > CFWheels, ColdFusion, Splash CMS > New Splash Tags for the Splash CMS

New Splash Tags for the Splash CMS

March 5th, 2010

I recently added several new Splash Tags for the Splash content management system. If you don’t know about Splash, read my Introduction to Splash article.

  • <s: find>
  • <s: children-each>
  • <s: children-first >
  • <s: children-last >
  • <s: ifFirst >
  • <s: unlessFirst >
  • <s: ifLast >
  • <s: unlessLast >

There’s a complete list of tags and documentation over on the GitHub Wiki. But, I’ll give you an overview and show you how to use these tags for a blog.

<s:find> This tag looks up a page and stores the page object so that subsequent tags can use that page object.

<s: children-each> The tag finds all the children of a page and loops over them.

<s: children-first > and <s: children-last > finds the first or last child page.

The rest of the tags are all used inside of a <s: children-each> tag. They check to see if the current child page is the first one, last one, or whatever.

Making a Blog page with Splash Tags

Let’s say you have a page named Blog, that has several posts that are child pages of Blog. Then, in the body for the blog page, put something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<h3>Articles</h3>
<s:find slug="blog">
  <s:children-each
  order="publishedAt desc"
  where="status='published'">
    <cfset thisChild = request.tags.currentChild>
    <cfoutput>
      <dt class="blogList">
         <a href="#thisChild.slug#">#thisChild.title#</a>
            | #DateFormat(thisChild.publishedAt, 'long')#</dt>
      <dd class="blogDesc">#thisChild.description#</dd>
    </cfoutput>
  </s:children-each>
</s:find>

<s:find slug=”blog”> finds the blog page, and then <s:children-each> loops over all the pages. By the way, <s:children-each> uses the CFWheels findAll model method, so all of the cool CFWheels parameters are available in <s:children-each>!

If you want to see an example of what this looks like, visit the DonorUp blog page.

All in all, that’s a lot of output for very little programming effort. That’s what I call the secret to programmer happiness!

Clarke Bishop CFWheels, ColdFusion, Splash CMS , ,

  1. No comments yet.
  1. No trackbacks yet.