CategoryPager using MT's CGI, not PHP
SomeMTPager, a category and comment pager using MT's CGI feature ( this is an updated version, but it is sufficient for you to use this CategoryPager plugin if you don't want to create a "Guestbook")
This Movable Type plugin makes you enable to use paging feature in "category archives". It's generally not necessary for us to page date-based archives because date-base can work intrinsic paging. But category archives will be longer and longer as time passes. So we need category paging.
In Movable Type system, if we want to use paging feature, officially we have to PUBLISH our entries with PHP or so, not with static HTML. Two constraint are required, publising and using PHP.
But Movable Type system itself is a dynamic system although we easily forget. If we use MT's unofficial feature like "mt-view.cgi", we don't have to PUBLISH(or REBUILD category archives), and don't have to use PHP.
You can see its result in here (although that is not from this plugin)
Requirement
- Movable Type 3.2
Installation
Download this plugin and untar it under (mt home) folder like $ tar xvfz CategoryPager-3.2.01.tar.gz. Then the files will be located as below:Configuration
1.
Open mt-config.cgi and set SafeMode to 0. Yes we go into adventure mode, not unsafe mode.
2.
Go to MT's Archive template menu and create a new archive template. We will use it as dynamic category archive template. Name it as like "Dynamic Category Pager". And if you want, just copy and paste the content of old category archive template.
3.
MUST modifiy <MTEntries> tag section as below.
...
</MTEntries>
...
<div id="..."><$MTCategoryPager how_many_pagers="3" $></div>
The value of MTEntries' offset attribute MUST be [MTPageOffset].
The [MTPageLastN=10] means an number of entries which will be displayed in one page.
<$MTCategoryPager$> displays numbered pagers. For example, if you set "how_many_pagers" to 3, the presentation of pager will be as follows.
<div id="...">1 | 2 | 3 | ... » 8</div> OR
<div id="...">1 ... « 5 | 6 | 7 » ... 12</div>
4.
Go to MT's "Edit Weblog Configuration" menu and select "Publishing" tab.
5.
Click "Create New Archive Mapping" and then match Archive Type "category" to "Dynamic Category Pager" template, and click "Add" button.
6.
In the Archive Mapping list's category section, you MUST select "Dynamic Category Pager" as "preferred" AND unselect "Category" ArchiveType, and save changes. You don't have to rebuild.
Yes, we don't publish any category archives. We use MT's dynamic CGI feature for displaying catergory archives. Don't be confused. Unpublishing category archives doesn't mean not being able to use category features. We can assign categories into an entry. So we don't use category-archive-related tags in templates, but can use category-related tags like MTCategoryID.
In here, you may have a question. If I can't have category-archive tags in template, how could I link to it? The answer is that we have to do it by hands like below step.
7.
Generally we have category archive links in Main Index. Below is a category archive link displaying part of MT 3.2's default Main Index templates
<div class="module-categories module">
<h2 class="module-header">Categories</h2>
<div class="module-content">
<MTTopLevelCategories>
<MTSubCatIsFirst><ul class="module-list"></MTSubCatIsFirst>
<MTIfNonZero tag="MTCategoryCount">
<li class="module-list-item">
<a href="mt/mt-view.cgi/<MTBlogID>/category/<MTCategoryID>/"><MTCategoryLabel></a>
<MTElse>
<li class="module-list-item"><MTCategoryLabel>
</MTElse>
</MTIfNonZero>
<MTSubCatsRecurse>
</li>
<MTSubCatIsLast></ul></MTSubCatIsLast>
</MTTopLevelCategories>
</div>
</div>
First, can this section be displayed? No. Why? <MTIfArchiveTypeEnabled archive_type="Category"> returns false state because we disabled category archive. So we MUST remove that container tag.
Second we can't use tags like <$MTCategoryArchiveLink$>. I wouldn't explain why. So we have to make links by hands. Dynamic links of category archive by mt-view.cgi is "mt-view.cgi/blog_id/category/category_id/". So we can design its link like above example. ( mt-view.cgi is located under MT home folder )
Caution : Link MUST be ended with slash(/)
Yes, that's all.
Notes
- This plugin applys only to <MTEntries> in category contexts. So only entry paging is possible. I have a plan that <MTPings> will be also possible in category contexts. This means category trackback ping paging.
License
Relased under the Creative Commons License.Version History
- 3.2.01 : First release.
Comments
Do you have any idea on Main Index pager in this way?
This plugin uses MT's unofficial CGI, so its dynamic perforamce is not as good as PHP.
I thought category archive is rarely(?) shown by visitors, so its dynamic performace is not so important.
Current plugin can't process Main Index Pager. and I'm also not sure if it or other method using MT CGI will do it.
I think best(?) method is to publsh entry with PHP, and theen using other MT's PHP pager.
Sorry for not suggest good solution.
Posted by: Yang | July 7, 2006 12:04 PM