Passing Parameters to a SnapOn

Most SnapOns are relatively self-contained, but there are times when, as a theme designer or a developer, you might need to pass a parameter or two to a SnapOn. The good news is that there is a syntax for doing that, for SnapOns that are embedded in overlays.

Here is the general syntax:


_{SnapOnName(memberVar1=123, memberVar2="stringValue")}_

Notice that really the "parameter passing" idea is nothing more than setting specific members of the SnapOn prior to processing the SnapOn. Also note that the Phoo phramework expects the string parameter values to be enclosed in quotes. Finally, at least as of version 1.34, it has been discovered that spaces between the last parameter value and the final closing parenthesis appears to muck things up. This will be fixed in a later version.

When would you use this? That's a great question. One common usage might be to get the Post Date to repeat on the front page of the blog, say, in a theme you're creating. By default, the Post Date only is displayed when it changes (in other words, if you have three posts for a given day, the Post Date - for most themes - will only display for the latest post.

Here's the syntax for a potential Post.header overlay utilizing the parameter passing discussed above (note the "repeat=true" parameter passed to the PostDateDisplay SnapOn. That is a member variable that that SnapOn uses to determine whether it should repeat or not).


<div class=post_header>
_{PostDateDisplay(repeat=true)}_
<div class=post_title>_{PostPermalink}_</div>
<div class=post_byline>
Posted by _@post_author@_ @ _@post_date@_ _@post_time_zone_abbrev@_
_{EditPostLink}_ _{DeletePostLink}_ _{TrackbackSendLink}_
_{PostTypeIndicator}_
Filed under: _@post_category_list@_
</div>
</div>