tips and tricks for movable type

entries by category in individual archives
April 06, 2002

Use SSI to generate a list of other entries in the same category on an Individual Entry Archive page. This requires a separate index template/file for each of your categories.

1) Create a new index template for each of your categories:

<MTEntries category="category_name">
<a href="<MTEntryLink>"><MTEntryTitle></a>
</MTEntries>

changing the name of the category for each template.

2) Set the output file for each new index template according to the dirified name of your category. Example: For a category named "Foo Bar", your file would be named "foo_bar.html".

3) In your Individual Entry Archive Template, place the following where you want the list of entries to appear:

<!--#include virtual="<MTEntryCategory dirify="1">.html"-->

This will reference the proper file to include based on the category for that individual entry. You'll possibly need to modify the path to match where you are keeping your new index templates in relation to your individual entries.

Note that on some servers, you would be required to change the extension on your archive files to .shtml or .shtm in order for Server Side Includes to work.

Comments

Great piece of code - managed to get it working eventually :-)

Any idea how we can limit the number of other entries to, say, the most recent 10? :)

by Andrew | 08.04.03 11:05 AM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 0
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/22)