From the "I didn't know you could do that" department:
So I was working with Beau on the implementation of a performance enhancement to Movable Type's search results and he showed me this really amazing trick that I doubt anyone knows about.
What we needed to do was suppress the comment and TrackBack counts from the search results page because a user in our community found that by removing them he dramatically sped up search results! However, we also wanted to use the same template module for displaying an entry's summary that we use everywhere else on the site. I thought we were going to have to create a special module just for search results, but then Beau showed me the following.
Did you know that you can pass parameters to template modules you include? I didn't. Within an include tag you can add any attribute and have that attribute passed to the included template as a variable. For example the include tag that includes the entry summary in the search results template would look like this:
<$MTInclude module="Entry Summary" hide_counts="1"$>
The hide_counts is a parameter that will be passed to the "Entry Summary" module as a variable. Then within the Entry Summary template module we can reference hide_counts like so:
<MTUnless name="hide_counts" eq="1">
<MTIfCommentsActive>| <a href="<$MTEntryPermalink$>#comments">Comments
(<$MTEntryCommentCount$>)</a>
</MTIfCommentsActive>
<MTIfPingsActive>| <a href="<$MTEntryPermalink$>#trackback">TrackBacks
(<$MTEntryTrackbackCount$>)</a>
</MTIfPingsActive>
</MTUnless>
The variable will also be made available to any templates that Entry Summary includes as well.
Very, very handy. Thank you Beau!


Daniel Stout
January 17, 2008 8:14 PM | Reply
That's an interesting and concise formulation. I've been using a slightly different technique to pass parameters -- just setting a variable. To use your example:
<MTSetVar name="hide_counts" value="1">
<$MTInclude module="Entry Summary"$>
Less concise, but it works about the same.
Jay Allen
January 24, 2008 12:17 AM | Reply
Wait, you're saying that you didn't spec out that feature? I smell a Brad. :-)
I did happen to know about this feature, but then again, I actually read every line of the release notes. I'm a glutton. Nice work all.