« MTDynamic v0.5 (Beta) | Main | MT Smileys »

MTDynamic v0.6 (Beta)

MTDynamic is a Movable Type plugin that is designed to facilitate the dynamic rendering of Movable Type blogs, using URL parmaters to control the display of entries and comments.

Download (v0.6)

Installation

1. Movable Type ships with a dynamic viewer (mt-view.cgi), which is described as an "experimental feature". To use to the viewer, you must turn "SafeMode" off. To do this, edit your "mt.cfg" file such that it includes the following:

SafeMode 0

There should already be a SafeMode section near the bottom of the cfg file.

2. Download and extract Dynamic.pl to your hard drive.

3. Upload Dynamic.pl to the "plugins" directory in your MT Installation.

Template Tags

MTDynamic creates two new tags, <MTDynamicEntries> and <MTDynamicComments>. These tags can be used in the same manner as MTEntries and MTComments - the tags will work in both static and dynamic views.

To use with the MT dynamic viewer, you need to use a path like:

http://www.yourdomain.com/path_to_mt/mt-view.cgi/1/index.html

where the number is the Blog ID of the blog. Index templates can be accessed using this format.

Now you can use URL paramters in the format of ?argument=value to control the entries that are displayed. Any of the MTEntries arguments can be used*. For example:

mt-view.cgi/1/index.html?lastn=10&category=Links

will display the last 10 entries posted by John.

*Note: to specify an author argument in the URL, you need to use a parameter called "entry_author". This is to avoid conflicts with the comment "author" parameter used with comment submissions.

Update (v0.6): To specify an "offset" argument in the URL, you need to use a paramter called "dyn_offset". This is to avoid conflicts with the "offset" parameter used with "rebuild files" tool.

To access individual entry pages using the dynamic viewer, use a path like:

http://www.yourdomain.com/path_to_mt/mt-view.cgi/1/entry/123

where "1" is the blog ID and "123" is the Entry ID.

MTDynamicComments includes two new arguments: start and show. I found that the "lastn" and "offset" approach can get confusing when listing comments, because usually you want to show them in ascending order. The "start" and "show" simplifies this:

start - the first comment to be displayed (chronologically)

show - the total number of comments to be displayed

Using this logic, ?start=11&show=10 will display comments 11 through 20. This can be useful for displaying blog entries with a lot of comments.

What if an argument is defined in the template AND in an URL parameter? In this case, the URL parameter value will override the value defined in the template. This enables you to create templates that can be used in both static and dynamic formats. For example, your home page might be presented in a static format, but you could provide filtered views of the home page using dynamic paths with parameters.

Examples

Using my Mars Rover Blog as an example, see that the home page contains blog entries and photos by two authors: Spirit and Opportunity. You can use MTDynamic to offer filtered views of the home page (note the path and URL parameters):

Only Spirit's blog entries and photos
Only Opportunity's blog entries and photos


This is my first plugin. I am sure there are bugs, please report any strange behaviour. Any and all comments, feedback, and suggestions are welcome.

Rate this entry:

  • Currently 3.5/5
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 3.5/5 (4 votes cast). Powered by the Ajax Rating plugin.

TrackBack

TrackBack URL for this entry:

Comments (12)

I am really excited, I think this is just what I need for my site. But am concerned about turning off SafeMode. Can you tell me more about the implications of doing this? What are the risks?

Thanks for developing this!

This is what I could find regarding SafeMode (from the MT User Manual):

``Safe mode'' enables certain warnings about security and other issues, and turns off some small features and capabilities (for example, linking templates to files with .cgi and other extensions). Safe mode is on by default; you can turn it off by setting SafeMode to 0.

Someone pointed me to your page because of what appears to be the magic plugin that I need for MT. I'm wanting to have my index page show 6 entries and then at the bottom have a link to the "Next 6 Entries", which goes to of course another page witht he next 6 entries with another link at the bottom going back another 6 and so on. Will this plugin do that? If so, could you please tell me how to implement it? I'm a very slow learner :) Thank you so much already!!!!

I also wrote a plugin that does some dynamic display of existing templates. The problem with this is that it's incompatible with a template that has other dynamic elements in it. For instance, if movable type would normally write out the template to a static page, and that static page would have php code in it that is intended to be dynamically processed, then the dynamic php code won't work anymore. It's pretty close to impossible to have a script that will dynamically display a perl template, and then spawn a php process to dynamically interpret the dynamically output perl code. (Sorry if that sentence is hard to read... it's hard to write, too!) :roll:

Shane,

This plugin does do that, but I have some enhancements planned in this area. Scroll to the botton of this page and you will see this in action. The "pages" links at the bottom take the visiotr to the next page. That said, those links are static, they is no intellegence to to them - I just decided to show 10 pages and created 10 links. In a future version of this plugin, I plan add an automated "pages" function that will determine the number of pages and create the correct number of page links.

(You may also want to try a plugin called MT Paginate - I haven't tried it myself, but it may meet your needs)

Gordon King:

Hey this is great, I've got it up and running on my site now.

chris davis:


is it possible to use MTDynamic to generate dynamic chunks of Atom XML?

I'm not up to speed on Perl and get aggitated every time I poke around the source for movable type ;)

thanks

Sure, you can use MTDynamic tags in any type of MT template, whether HTML or XML.

Hi Mark -

A client of mine uses MTDynamic with an MT 3.2 installation (perhaps not the best setup :), and I found that it is including comments that have been junked. To get around this, I added some code to account for comments that are visible only. You may (or may not) care to address this in your plugin, just wanted to let you know.

Thanks for the note, Chad.

I know that I did update the plugin after upgrading the plugin, as I noticed the same thing. I guessed I never released the update. I suppose I should do that... ;)

A team of successful entrepreneurs credited for www.SelectWealthSystem.com
A new home-based-business marketing system that provides the strategic high ground for internet marketing.
Pro Team Marketing uses an automated marketing system that is currently promoting a cutting-edge young company, entering the early growth stage, that targets the largest consumer base in the United States with their financial educational products.
http://www.SelectWealthSystem.com

bilal:

Thanks for giving such a very good information.. Still now I didn't came across this one.. This one seems to be nice one.. Is this one is the latest version or anyother else beaten this one..
=====
bilal
Social Media Marketing - 36556634.4210489 http://www.widecircles.com

Post a comment

Gift idea: Buy Seinfeld DVD box set, complete 9 seasons!