Please forgive me if this information is easily found somewhere. I've spent about half an hour using Google and this forum's search unsuccessfully, but you never know if you're missing something obvious.
I am trying to use mt:If to compare the values of two tags. (In my case, mt:CommentEmail and mt:EntryAuthorEmail. Since I am not using registration for my commenting, I want to evaluate whether the comment author is the author of the email by a simpler test.)
None of the examples on the mt:If documentation page use tag values, and I'm having a hard time tracking down any source that tells how to accomplish this.
http://www.movabletype.org/documentation/appendices/tags/if.html
Any help anyone can provide would be most helpful. Thanks!
Reported on Movable Type 4.2
After much searching I finally found out how to use mt:SetVarBlock to accomplish this. I've added a comment to the mt:If reference page in an attempt to help anyone else who may have this problem in the future.
http://www.movabletype.org/documentation/appendices/tags/if.html#comment-19277
<mt:SetVar name="MyCommenterEmail" value="<$mt:CommentEmail$>"> <mt:If name="OwnerEmail" eq="<$mt:EntryAuthorEmail$>"> <!-- do something --> </mt:If>Example (based on default Comment Detail template: http://www.movabletype.org/default_templates/4.2/comment_detail.mtml):
<mt:SetVar name="MyCommenterEmail" value="<$mt:CommentEmail$>"> <div class="comment<mt:If name="OwnerEmail" eq="<$mt:EntryAuthorEmail$>"> YOUR_CSS_CLASS</mt:If>"<MTIfArchiveTypeEnabled archive_type="Individual"> id="comment-<$MTCommentID$>"</MTIfArchiveTypeEnabled>> <div class="inner"> <div class="comment-header"> <div class="asset-meta"> <span class="byline">By <span class="vcard author"><$MTCommentAuthorLink default_name="Anonymous" show_email="0"$></span><MTIfNonEmpty tag="CommentAuthorIdentity"><$MTCommentAuthorIdentity$></MTIfNonEmpty> on <a href="#comment-<$MTCommentID$>"><abbr class="published" title="<$MTCommentDate format_name="iso8601"$>"><$MTCommentDate$></abbr></a></span> </div> </div> <div class="comment-content"> <$MTCommentBody$> </div> </div> </div>Sorry, this code is true:
<mt:SetVar name="MyCommenterEmail" value="<$mt:CommentEmail$>"> <mt:If name="MyCommenterEmail" eq="<$mt:EntryAuthorEmail$>"> <!-- do something --> </mt:If><mt:SetVar name="MyCommenterEmail" value="<$mt:CommentEmail$>"> <div class="comment<mt:If name="MyCommenterEmail" eq="<$mt:EntryAuthorEmail$>"> YOUR_CSS_CLASS</mt:If>"<MTIfArchiveTypeEnabled archive_type="Individual"> id="comment-<$MTCommentID$>"</MTIfArchiveTypeEnabled>> <div class="inner"> <div class="comment-header"> <div class="asset-meta"> <span class="byline">By <span class="vcard author"><$MTCommentAuthorLink default_name="Anonymous" show_email="0"$></span><MTIfNonEmpty tag="CommentAuthorIdentity"><$MTCommentAuthorIdentity$></MTIfNonEmpty> on <a href="#comment-<$MTCommentID$>"><abbr class="published" title="<$MTCommentDate format_name="iso8601"$>"><$MTCommentDate$></abbr></a></span> </div> </div> <div class="comment-content"> <$MTCommentBody$> </div> </div> </div>