Home > A widget for showing your last 10 replies

A widget for showing your last 10 replies

October 19, 2009 Mike 0 comments
I created this widget in response to this request on the Movable Type forums. It's complicated, but readable. If added to a blog, it will need to be cached using template module caching because it contains several block tags which will do database lookups.

<div class="widget-my-last-replies widget">
    <h3 class="widget-header">My Last Responses</h3>
    <div class="widget-content">
<mt:Comments blog_id="2" sort_order="descend" lastn="100">
    <mt:CommentReplies>
        <mt:If tag="CommenterID" eq="1">
            <mt:setvarblock name="push(permalink)"><mt:commentlink/></mt:setvarblock>
            <mt:setvarblock name="push(entries)"><mt:commententryid/></mt:setvarblock>
            <mt:CommentParent>
                <mt:SetVarBlock name="push(parent)"><mt:CommentAuthor/></mt:SetVarBlock>
            </mt:CommentParent>
        </mt:If>
    </mt:CommentReplies>
</mt:Comments>

<mt:loop name="permalink">
    <ul>
    <mt:If name="__counter__" lt="10">
        <mt:var name="__counter__" setvar="counter"/>
        <mt:var name="counter" op="--" setvar="counter"/>
        <mt:var name="entries[$counter]" setvar="eid"/>
        <li>I <a href="<mt:var name="permalink[$counter]"/>">replied to <mt:var name="parent[$counter]"/><a/> who commented on
        <mt:Entries id="$eid">
            <a href="<mt:EntryPermalink/>"><mt:EntryTitle/></a>
        </mt:Entries>
        </li>
    </mt:If>
    </ul>
</mt:loop>
    </div>
</div>
Categories: Tags: , , ,
  1. No comments yet.