SomeMTPager, a category and comment pager using MT's CGI feature
This entry especially explains how to create a Guestbook (
My MT guestbook example) by using this plugin and MT's dynamic features.
It is an updated version of CategoryPager plugin. If you want to apply pager to entries in category archives, you can also do by using it, however you should refer its explanations in Categorypager using MT's CGI (Be careful old <$MTCaterotyPager$> tag is changed to <$MTSomeMTPager$>)
It adds a comment paging feature in Individual entry archive. But you have to know it is not a general purposed comment pager.(I can't guarantee its other application) It's developing purpose is to make a guestbook with pager by Movable Type. It never publish any static files, it only uses MT's dynamic CGI featue like mt-view.cgi. In default MT, commenting is done by mt-comments.cgi. However I chose to use mt-view.cgi in order to avoid potential collisions, because some not so few plugins or hacks use mt-comments.cgi.
To make a Guestbook with pager, you only need to create additional blog. And all four templates(Site Javascript, Stylesheet, Individual, Comment Listing templates) and no publishing with any archve type will be enough.
As shortly explained above, this guestbook works dynamically. So you don't need to publish any entries, archives. Then you might ask, could a guestbook ugins MT/Perl CGI have a good performance? My guestbook is based on Berkley file DB and have a few test messages by me. So I can't assure its dynamic performance. However, I can tell you that "Guestbook" is not a BBS. You and your visitors nearly don't use "search(highy dynamic)" feature and don't navigate guestbook. At times you(the guestbook owner) only use page navigation. As a result, guestbook don't need high dynamic performance. Instead guestbook need only a fast commenting(leaving a message) response and some anti-spam features.
By using MT's CGI in creating guestbook, we can benefit some like using MT's several anti spam featues/plugins and using familiar MT template in design and MT's StyleCatcher plugin to adapt easily well-made skins.
Why not invest half an hour(except for your own nice CSS designing time) to add your guestbook?
Requirement
- Movable Type 3.2
Installation
Download this plugin and untar it under (mt home) folder like $ tar xvfz SomeMTPager-3.2.02.tar.gz. Then the SomeMTPager.pl file will be located in (mt home)/plugins/alogblog/ folder.Steps for creating Guestbook using this plugin
0.
Open (mt home)/mt-config.cgi and set "SafeMode" to "0".
1.
Create a new weblog for guestbook and configure it as follows.(Remember blog ID)
- In Index Templates, delete all except for Site JavsScript and Stylesheet templates.
- In Archive Templates, rename "Individual Entry Archive" to "guestbook" and delete "Category" and "Date-Based" archives.
- In New Entry Defaults of "Edit Weblog Configuration" menu, select "Accept Comments" and unselect "Accept TrackBacks".
- In Feedback menu, unselect "Accept TrackBacks" and set Comments status as you like.
- In Publishing menu, delete all Archive Mappings except for "guestbook" Individual Archive Mapping, and unselect "Individual" Archive Types. As a result, we have one "guestbook" archive mapping, however actually we don't publish that "guestbook" archive into any static file formats.
2.
Create a new entry and enter some welcome messages in Entry Body area.(Remember entry ID)
This text will be displayed in Guestbook. Guestbook is just an entry which allows visitors to leave a comment. So if you want multiple guestbooks for any reason, you can get it by creating a new entry.
3.
Open "Comment Listing Template" in System Template tab menu. Delete all contents and enter below one line.
4.
Open "guestbook" Archive template.
Find <input type="hidden" name="static" value="1" /> line, and chage "1" to "0".
...
<div class="guestbook-<$MTCommentEvenOdd$>">...</div>
...
</MTComments>
</div>
<div id="msg-nav"><$MTSomeMTPager how_many_pagers="3" $></div>
Find <MTComments> tag and add following attributes. [MTPageOffset] is required. [MTPageLastN=5] means the number of pages to be displayed in one page.
Within <MTComments> container tag, you can use <$MTCommentEvenOdd$> tag. It outputs "odd" or "even". Using this, you can apply different design in even/odd guestbook-comments.
<$MTSomeMTPager$> display numbered pager. If how_many_pager="3", the pager output will be like <div id=..>1 | 2 | 3 ...10</div>
5.
Look through "guestbook" template again. Some trackback-related tags and some meta tags are not required for a guestbook. As possible as you can, you need to simplify "guestbook" template, because this template is to be used dynamically. And design "guestbook" template to your taste as like inserting links to your blogs.(You can see my guestbook's HTML.)
6.
Open "Site Javascript" template and find all static="1" and then change "1" to "0". Three static="1" may exist.
That's all.
Lastly you will need to embed "Guestbook link" to your blog pages.
The URL of guestbook is like "your_domain/path_to_mt/mt-view.cgi/4/entry/62/guestbook/".
In this example, "4" is your guestbook blog's ID, and "62" is entry ID. That URL must be ended with slash(/).
Notes
- Numbered pagers are output using <li> tags. So you need to apply some CSS rules, below is my CSS rule.
/* Example of pager CSS */
#msg-nav { text-align: center; }
#msg-nav li { list-style:none; display:inline; }
#msg-nav li a { text-decoration: none; padding: 5px; }
#currentPage { color: red; }
#msg-nav li a:hover { border-top: 3px solid red; } - In (mt home)/plugins/alogblog/SomeMTPager.pl, you can customize some pager design.
- What if one entry(=one guestbook) has quite so many comments? Then it may lessen its performance. I think in that case in future, you create a index template, and publish your old guestbook message into static files and embed those links to "guestbook" template page. So static old page plus dynamic guestbook we can use. And then delete old comments. Its only up to you.
License
Relased under the Creative Commons License.Version History
- 3.2.02 : Add comment paging feature.
- 3.2.01 : Paging entries in category archive.
Post a comment