I've posted
previously about mt-view.cgi. This is an "experimental" script that's been shipping with MT since the release of MT 2.6 a year ago. I'm using mt-view.cgi to create dynamically-generated individual archive pages for Al-Muhajabah's Islamic Blogs, as well as
printable versions of my entries, both at Al-Muhajabah's Islamic Blogs and here.
The purpose of this entry is to give a little more background on mt-view.cgi and how to use it. Because the script is considered "experimental", there is no documentation. However, some information about how to use it can be gleaned from MT's source files.
The way that MT works, it creates static webpages. When a new entry or comment is added, certain of these webpages are rebuilt and updated with the new information. Typically, all index pages and the archive pages where the entry (new entry or commented-on entry) is found are rebuilt. However, if you do something like list recent entries on each individual entry archive page, these will not be updated. Also, if you make a change to your archive templates, you have to rebuild all the archives. This can be a very time-consuming process if you have a large blog with a lot of entries.
For these and other reasons, you may be interested in dynamically generating your blog archives. First turn off safe mode in your mt.cfg file by including the following line:
SafeMode 0
The dynamically-generated versions of your templates can be accessed as follows:
Index templates: http://path.to.mt/mt-view.cgi/
blog_id/
filename.htm
Category archives: http://path.to.mt/mt-view.cgi/
blog_id/section/
category_id
Individual archives: http://path.to.mt/mt-view.cgi/
blog_id/entry/
entry_id/
template
Daily archives: http://path.to.mt/mt-view.cgi/
blog_id/
yyyy/
mm/
dd
Weekly archives: http://path.to.mt/mt-view.cgi/
blog_id/week/
yyyy/
mm/
dd
Monthly archives: http://path.to.mt/mt-view.cgi/
blog_id/
yyyy/
mm
Replace
path.to.mt with the URL of your MT directory. Insert blog, category, and entry IDs as appropriate.
Yyyy stands for the four-digit year,
mm for the two-digit month, and
dd for the two-digit day for the by-date archives.
Filename.htm refers to the output filename of the index template you want to display.
Template refers to the individual entry archive template you want to use. This option requires the use of the
custom dynamic pages hack.
If you are creating links to the dynamically-generated pages in your templates, you can make use of MT tags to supply some of the data.
Note that if you use PHP in your templates, the PHP code will appear unparsed in your dynamic pages. This is because PHP and CGIs don't play well. See my entry on my dynamic individual entry archives for a workaround. This only works on individual entry archives and not on category or by-date archives; these would need additional hacks.
In addition to having dynamically-generated archives, you may wish to have dynamically-generated index pages; you can see this is an option above. You can easily get around the PHP problem by creating a new index template that doesn't use PHP or to include the results of mt-view.cgi in a PHP page (the workaround mentioned above). No hacks are needed here.
Why might you want to do this? Many people like dynamically-generated indexes because they want to display entries or comments from the database in any combination without having to create a static page for each one.
If you want to do this in MT, take a look at the
MT-Dynamic plugin. This allows you to add arguments to the mt-view.cgi filename to display entries in a certain way. For instance, to use your main index template but only display entries in a certain category, you could use the following URL:
http://path.to.mt/mt-view.cgi/
blog_id/index.htm?category=category
In the template, you would have to replace your <MTEntries> container tags with <MTDynamicEntries> in order to get this functionality.
The following arguments can be used in the display of entries: entry_author, category, lastn, dyn_offset, days, recently_commented_on, sort_by, sort_order.
You can also do this with comments; here you might want to use dynamic individual entry archives rather than an index page. Replace <MTComments> with <MTDynamicComments> in your template. You can use the following arguments: start, show. These are similar to lastn and offset but make better sense with the way comments are displayed.
I have not yet implemented MT-Dynamic but am looking into ways that I might do so, inshallah.