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"$>
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!