Previous and next in category

I’m not sure how generally useful this is, but if you need it, it may be close to what you need. PreviousNextInCategory is a plugin that adds two container tags, <MTEntryPreviousInCategory> and <MTEntryNextInCategory> that work just like the <MTEntryPrevious> and <MTEntryNext> tags, except that they give you the previous and next entries that are in the same category as the primary category of the current entry.

Which is where things can get a little weird: if you have a previous entry that has the primary category Food, but the secondary category Sex, then as you browse backward through Sex entries, when you hit that Food entry (because it’s also Sex), you’ll suddenly switch over to browsing Food instead of Sex. So it’s probably most useful for something like the original problem, where you only have a few distinct categories, or for people like me who rarely remember to add more than one category.

In any case, I’ll probably leave it doubled up with the by-date links on my archives until I get tired of seeing it. One other thing it might be good for, displayed the way I have it: it encourages you to write about a variety of things, since it looks rather stupid when the previous and next entries by category are also the previous and next entries by date, giving you two lines of the exact same links.

90 Comments

Comment by jespes #
2005-03-13 11:56:34

Hello,
This is a terrific idea, thank you.

Unfortunately… I can’t get it to work. Both MTEntryPreviousInCategory and MTEntryNextInCategory call the current page. (EG if I’m viewing page ”archive-page-15,” both codes simply call that page over and over, instead of going to 14 or 16.)

I’ve backed all the way out and tested in the original, unmodified ”individual archive template” that comes with MT. The two codes do the same thing for me there.

Have you ever heard of this problem? I’m using MT 3.15.

Many thanks, best regards,
JP

 
Comment by Mushlette #
2005-03-31 09:54:17

I just hadda say that the COMMENTS ON THIS POST ARE HYSTERICAL.

Now I’m off to find a donut.

 
Comment by Joseph #
2005-04-17 18:26:06

THANKS! This was a great help. . .

 
Comment by Chris #
2005-06-16 19:57:56

Your plugin works great! however, I am trying to use it in an another way. What I want is to have two individual templates, the original individual template will have a button on it, and will go though the whole blog by entry. Then I want to create another individual archive template, and name it ”Individual Category template”. When a person clicks on a category, they will get to another individual template.

Here is an example on what I am trying to do

http://www.pixelfight.com/pf/archives/2005/06/000140cat.php

How can I make your plugin go though all the 000***cat.php pages?

Thanks in advance

 
Comment by rmcmahon #
2005-07-08 04:43:11

Wow, I’ve been looking for something like this for a while. It worked great with my older (2.63) version of Movable Type. Thanks!

 
Trackback by MT Plugin Directory #
2004-02-08 01:24:19

PreviousNextInCategory

 
Trackback by Gwen Harlow resources #
2004-02-10 13:17:56

Category navigation

Previous and next within category, formatting buttons

 
Trackback by KO #
2004-02-10 22:56:40

Extending Movabletype

Prev/Next Links within Category Position of Individual Archive in Category List Total Number of Entries in Category i.e Have Entry #x of Total Entries in that category, and previous/next links within category. Usefull for photoblogs….

 
Trackback by Building things #
2004-02-14 14:21:49

Individual archive navigation by category

Requires MySQL and two plugins; other options

 
2004-02-18 18:37:43

Colophon

colophon ( P ) Pronunciation Key (kl-fn, -fn) n. 1. An inscription placed usually at the end of a book, giving facts about its publication. 2. A publisher’s emblem or trademark placed usually on the title page of a…

 
2004-03-27 16:54:27

show the previous and next entry in category

On my individual entry archive page I provide links to the next and previous entries in the category instead of overall. This is particularly important for the way that I have my blog set up, since the three categories (A…

 
Trackback by Learning Movable Type #
2004-04-22 17:38:49

Creating a Photo Album

There are many ways to create a web-based photo album or photoblog in Movable Type. This tutorial addresses just one method for creating a photo album, and is based on the steps I took to create my MT-based photo album….

 
Trackback by Ruby site #
2004-04-24 11:55:41

複数Category?ページ???り

COCOOONS.ORG?ん??Category内??ページ???り????を見?。 ???人も?「CONQUE TINT WORKS?ん?エントリ? MT(カテゴリ内?ページ???り)????読ん????る???ー??リンク???…

 
Trackback by geek and proud #
2004-04-29 15:25:15

Next and Previous in Category

I just found the Next and Previous in Category MT plugin. Previously, to separate my from the main one, I…

 
Trackback by heimatseeker #
2004-05-05 16:32:52

i witness

Meet i witness, heimatseeker’s very own, brand-spanking new photoblog! I had been exploring for a while how to better accommodate those images that are not than just decoration for blog entries, nor fit into the more instant and immediate, but low-qual…

 
Trackback by Ruby site #
2004-06-05 06:42:02

複数Category?ページ???り??構築

「複数Category?ページ???り???phil ringnalda dot com?ん??PreviousNextInCategoryを若干改造??使用???・・・?1?実?気?入ら??所????。 新?エントリ?????や?更新?カテ…

 
Trackback by ?ょ??ニュース #
2004-08-14 17:30:41

カテゴリー内?後移動リンク作?

??よ??よ?: ?一カテゴリー内?記事??後移動

MT?場?、普通?「記事?…

 
Trackback by Play with Weblog! #
2004-08-19 21:43:53

カテゴリ内?次・?リンク

?々?ら便利????????カテゴリ内を渡り歩??リンクを??る?????。
使?…

 
Trackback by Diary::Weblog #
2004-09-23 04:56:58

?一カテゴリー内?記事??後移動

通常?主??Blog・CMSツール??れ??「エントリー??後移動???能?よ??????る。 ?????MovableType?場?「?一カテゴリー内?記事???定????後移動?デフォルト??…

 
Trackback by KDC blog #
2004-11-23 02:33:58

MT改造メモ

■Individual archives????カテゴリ?最新記事一覧を表示??る方法。 ??????カテゴリ別?リンクを貼???るサイト???個別ページ?飛ん?らや??り???カテゴリ内?最新記事…

 
Trackback by JimSpot #
2005-01-16 18:35:56

Dynamic Publishing Issues

I’ve been rebuilding the back-end functionality of my blog to where it was before the BlogFucks issues nuked JimSpot. Basically, that means that I’m manually reinstalling the plugins that I had up and running here before. Since the Plugin manager…

 
Trackback by Cordelya #
2005-01-27 19:57:12

Acknowledgements

In the vein of giving credit where credit is due, I give you the Acknowledgements Post. I’ll begin by thanking Six Apart for developing the MovableType software and for offering a free version of it. I would also like to…

 
Trackback by Movalog #
2005-01-31 22:14:08

PHP PreviousNextInCategory

I really liked Phil Rignalda’s PreviousNextInCategory that would basically show the Previous/Next entries in the same category as the current entry (kinda like <MTEntryPrevious> and <MTEntryNext>) Unfortunately this plugin didn’t work under…

 
Trackback by HiLOG #
2005-02-05 15:15:18

?一カテゴリ??後?記事??リンクを表示?自動?構築

 日記?個別ページ??標準?テンプレート??後?記事??リンク?設定?れ??る??カテゴリ?よ??全??別?テーマを扱???る???表示?れる記事タイトル??和感を???…

 
Trackback by AtBGCg #
2005-04-09 23:20:07

JeS̑ŐL𕎦

?@Movable Typeł͑ŐL𕎦邱Ƃ?o܂?AJeS̑ŐL𕎦邱Ƃ?o܂?B?ÃvOCCXg?[܂?Bphil ringnalda dot com: Previous an…

 
2005-05-11 02:22:02

カテゴリ内?ページ???りを?る

プラグインを使??個別ページ??一カテゴリ???後ナビゲーションを設置?る。PreviousNextInCategoryプラグイン????????使?????記述を追加?る必???る。

 
Trackback by gekka blog #
2005-05-20 01:44:55

?一エントリー内??後?

自分?日本一周ツーリング日記を読?返?????「??日?「次?日??見?????????プラグインを入れ?対処。 phil ringnalda dot com: Previous and next in category やり方?? プラグイン…

 
Trackback by Alex | weblog #
2005-05-29 14:05:49

Crear una galeria de imagenes con movable type

Breve explicación de como crear una sencilla galería de imágenes usando Movable Type como software de base.

 
Trackback by danandsherree.com #
2005-09-18 11:15:58

About this Site

danandsherree.com is run with Movable Type, a content management system. The site’s design, Scrapbook, is a ground-up design of XHTML…

 
Comment by Jordan Breckenridge #
2005-11-12 00:43:59

Phil –

Great plugin. I’ve seen it used on several sites and it looks exactly what I’m looking for.

Unfortunately, when I use it on my individual archive page, the ”next” link takes me forward to what seems like an arbitrary entry within the category. The previous/next of a given entry are the same arbitrary entries each time the blog is rebuilt. If I go to the entries that are being ”skipped”, the previous/next on those pages has a similar weird behavior also going to other entries within the category.

The only thing that I think is somewhat unique is the fact that I am using subcategories (assigned as the primary category). Would that make a difference? I’m using MT 3.17 – any help you can provide would be appreciated.

Comment by Phil Ringnalda #
2005-11-12 20:07:09

Wow, it’s been a long time since I looked at this code. I really don’t have any idea what I was thinking: when it looks for whether a previous entry is a match, it compares the category label (the name that you see) rather than the ID: do you by any chance have subcategories that have the same name, but different parents? I’d guess that if you were on an entry in the

Dogs
    Food

category, and the entry just before (or, closer than the previous one in the same category) was in

Cats
    Food

you would end up going back to that one. Other than that, I don’t see any reason why it wouldn’t work with subcategories: they are just categories where $category->parent isn’t ”0”.

I’m shopping for someone to adopt this plugin, since not using MT anymore is going to make me even less likely to improve it: maybe its new daddy will have an idea (or will fix it by correcting whatever mistake I made).

 
 
Comment by Michael Schuld #
2006-01-23 00:45:46

Life saver, I direly needed this for the new changes I made to my blog layout and organization, and all I had to do was type in ”MTEntryNextInCategory” in Google (yes, I did guess it that well ;)) and here it is! Thanks for this one.

Comment by Aristotle Pagaltzis #
2006-01-23 04:13:27

Ah, the wonders of the LazyWeb. :-)

 
 
Comment by Rodney Blevins #
2006-06-30 04:25:21

Wow, thanks for this plug-in. The reason I need it, is because I have two distinct categories: News and About Us, and when people are reading our latest news, it’s confusing if they all of a sudden run onto an ”about us” article which I don’t update so often and keep on a separate category page altogether.

 
Comment by Amin #
2006-09-04 14:19:32

Hi,
I love your plugin. But there is a BIG problem. I can use this plugin on my small weblog (400 entries w/ 6 Categories) but when I tried to use it for my huge weblog (3000 entries w/ 50 Categories) when I want to rebuild it, in the little rebuilding window, it stops at rebuilding first 40 for 3 mins then goes to a white page and status says ”Done”.

I used other ways like the sql plugin and the other php ways but all of them has a problem. The one that just worked perfect was yours which I can’t use!!!

Do you know what is the problem?

(when I disable your plugin in my huge weblog, it rebuilds fine…)

 
Comment by Amin #
2006-09-06 16:20:59

I am pretty sure I asked you a question here and my comment was #comment-82858. If you don’t wanna help, why do you delete the comment?

Tnx for the plugin! /:)

 
Comment by Phil Ringnalda #
2006-09-06 20:01:45

Nah, not deleted, just moderated because I’ve been alternating between busy and offline this summer, and haven’t been posting anything that anyone would comment on anyway.

But I’ve got nothing in particular to offer: I quit using Movable Type going on a year ago for exactly that reason: any time you want to do something fun, you wind up with something between unhelpful and invisible error messages. Other than changing whatever the config variable is for entries per rebuild to a very small number, my only idea would be to find an active plugin developer who actually enjoys Perl and MT, and convince him to take over the plugin and improve its behavior.

 
Comment by Phil Ringnalda #
2006-09-06 20:05:05

Hrm, 82858 indeed. So that’s close to 1000 spams per day during the two days I let it sit in moderation.

I miss the old days.

 
Comment by trevor #
2009-05-21 19:22:36

Hi phil – looks like the link to download the previous and next in category MTplugin no longer works. Drops me off back at your homepage. I have use for this if you have an alternate download link!

Comment by Phil Ringnalda #
2009-05-21 19:37:09

Oops, sorry, fixed now. I archived a bunch of mangy old stuff, including nine installs of MT all in directories starting ”mt”, and three other bits of old ”mt__” stuff, and forgot that there was one thing starting with mt that wasn’t dead (unless they all are: I don’t even know what the current version of MT is, much less whether anything I wrote still works with it).

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.