Help - Search - Members - Calendar
Full Version: Two Template Questions
Movable Type Community Forum > Additional Resources > Tips and Tricks
strangelittleboy
Question 1) I want to have the following at the top of my page: home > journal > entry #345.  What sort of template tidbit do I use to display the entry number?  Is this possible?

Question 2) I've only really seen people posting "problem" posts about this, and I just want to know outright how to do it... I want to display the last 5 commented on entries... what is the template to acomplish this?
almuhajabah
1) Try something like

CODE
home > journal > entry #<$MTEntryID$>


You should be aware that the IDs are for across your entire MT install so if you have multiple blogs they all have the same numbering system, rather than each blog having its own numbering system

2) If you want to only list the entries that were commented on, use:

CODE
<MTEntries recently_commented_on="5">
...
</MTEntries>


3) If you would like to display the comment and also indicate what entry it came from, and you are using MT 2.5 you can do something like this:

CODE
<MTComments lastn="5" sort_order="descend">
<$MTCommentAuthor$> <a href="<$MTCGIPath$>mt-comments.cgi?entry_id=<$MTCommentEntryID$>" onClick="OpenComments(this.href);return false" title="click to view comments">said</a> <MTFirstNWords n="15"><$MTCommentBody$></MTFirstNWords>... (<$MTCommentDate format="%m/%e/%y @ %I:%M %p"$> in <MTCommentEntry><a href="<$MTEntryLink$>#<$MTEntryID$>" title="click to view entry"><$MTEntryTitle$></a></MTCommentEntry>)<br><br>
</MTComments>


This will show the last five comments, with the most recent on top and the display will look something like:

QUOTE
almuhajabah said blah blah blah.... (10/10/02 @ 02:01 PM in entry title)


where the underlined parts will be links, the one on "said" to the comments pop-up for that entry and the one on the entry title to the permalink for the entry.

Note: I am using the FirstNWords plugin. If you don't have this, replace

CODE
<MTFirstNWords n="15"><$MTCommentBody$></MTFirstNWords>


with

CODE
<$MTCommentBody trim_to="40" remove_html="1"$>


I like the FirstNWords plugin because it allows you to set the number of words rather than the number of characters that will be displayed, and it automatically strips the HTML
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.