UPDATED 09/10: There was a problem with the files as phps so I've zipped them
UPDATED 09/04: To fix SmartyPants

So you've downloaded the very new 3.1 with all the amazing features but you've found one problem, your plugins no longer work with the dynamic templating. Well its not only plugins, text filters also no longer work.... Here are some methods by which you can combat this problem, some may not work in all cases but its better than nothing for other cases.

  • Text Filters In a previous tutorial I had linked to PHP Markdown, but a few people have contacted me about Textile as well. So I have collected PHP versions of Markdown, Textile and SmartyPants Just download the following files and upload them to MT_DIR/php/plugins - you may need to create it. Alternatively if your server supports extracting of zipped files, then put the zipped archive in MT_DIR and extract them from there and the files will be put into the correct locations automatically.

Markdown

markdown.zip
markdown.tar.gz

Textile

textile.zip
textile.tar.gz

These are the files from MT 3.1 rc 3.

SmartyPants

After a bit of tinkering with PHP Smartypants

smartypants.zip
smartypants.tar.gz

Markdown & Smartypants

If you wish to use Markdown in conjunction with Smartypants, download

markdown_smartypants.zip
markdown_smartypants.tar.gz

  • Perl Plugins: Current perl plugins will not work on dynamic templates and will need to be ported over to php. Until such a time one way to still use perl plugins is to put them into a static index template. For example MTBlogShares will not work with dynamic templating. So I can put it into a template called blogshares.php and rebuild that. Then I can put a simple line in my php templates to include that file:
{{include file="blogshares.php"}}

or if you feel more comfortable using MT Tags:

<$MTInclude file="blogshares.php"$>

Of course this make not work for all plugins but will for some. Alternatively you could scan the Smarty Plugin Directory. I've seen PHP ports of some MT plugins there.

33 Comments

Thomas said:
on Sep 3, 2004 11:56 AM | Reply

Hello, I tried to take a look at (and later, I might download) the modifier.Markdown.php .. but, how to download? To view, why not .phps? or .txt?

I could not save it.

Thank you.

Arvind Satyanarayan said:
on Sep 3, 2004 11:58 AM | Reply

Whoops it should be fixed now, sorry !

David Raynes said:
on Sep 3, 2004 4:47 PM | Reply

When you say the plugins are broken, am I correct in assuming that you mean only in dynamic templates?

Arvind Satyanarayan said:
on Sep 3, 2004 10:04 PM | Reply

Yes that is what I mean, perhaps I should make that a little clearer...

Anil Dash said:
on Sep 3, 2004 10:38 PM | Reply

To be clear, the PHP templating system is an additional way of doing templates in MT. You can use Smart plugins, as Arvind has documented before, with the PHP templates. It's only if you change from static perl templates to dynamic PHP templates that you'll want to use PHP plugins instead of perl ones.

I don't mean to be pedantic, but the plugins work fine in the environment where they were designed. (You can mix static pages with dynamic ones in MT3.1) So I'm not sure "broken" is an accurate description.

Arvind Satyanarayan said:
on Sep 3, 2004 11:02 PM | Reply

Ok perhaps "breaking" is rather sensational.

Brad Choate said:
on Sep 6, 2004 3:02 PM | Reply

I would also recommend using the standard "MTInclude" tag along with the "file" attribute for doing file-based includes. The smarty syntax works as well naturally (for dynamic pages only obviously), but for MT templates, better to use MT tags whenever possible, to avoid confusion.

Arvind Satyanarayan said:
on Sep 6, 2004 3:09 PM | Reply

Thanks Brad, updated the entry !

Icyshard said:
on Sep 7, 2004 12:49 AM | Reply

Ok, I downloaded the Smartypants files, saved as .php and uploaded to MTdir/php/plugins, which I created. Nothing changed. I still have the commands smartypants="1" in my templates....do I have to use a different syntax to call the function, or is there something else I need to do to get it to work?

Arvind Satyanarayan said:
on Sep 7, 2004 4:35 PM | Reply

Hi

Could you try downloading modifier.smartypants.php again please ? I changed it, hopefully it should work now. I did not write the PHP Smartypants but I would assume the syntax is the same.

Icyshard said:
on Sep 8, 2004 4:55 AM | Reply

Yay, that did the trick, thanks!1 :)

Just so you know though, you have an extra ")" in line 4 of the modifier code. It works fine once you take it out. Oh, and previously the smartypants function was called by using smarty_pants="1", but your version calls it by using smartypants="1" (no underscore). Not a big deal, but it could confuse some people who wonder why the plugin doesn't work right away.

Anyway, thanks for figuring this out!

Arvind Satyanarayan said:
on Sep 8, 2004 12:46 PM | Reply

Great it works, I'll edit that line as soon as I can thanks for pointing it out. I have no control on the syntax used sorry, I didn't write the script just converted it such that it works with Smarty and MT !

Jason Mevius said:
on Sep 9, 2004 6:56 AM | Reply

I'm just now trying the SmartyPants formatting with MT 3.1 dynamic, but am running into problems.

I've downloaded the two smarty files, changed the extension to .php and have uploaded them to my /path/to/mt/php/plugins directory.

Now, I'm getting this error:

php
include_once "smartypants.php";
function smarty_modifier_smartypants ($text){
return SmartyPants($text);
}


The requested page could not be found.
Smarty error: [in mt:35 line 3]: [plugin] function smarty_modifier_smartypants() not found in
/path/to/mt/php/plugins/modifier.smartypants.php (core.load_plugins.php, line 73)

Any ideas?

Eduardo Arcos said:
on Sep 9, 2004 8:02 PM | Reply

Thank you very much for helping us into the transition to dynamic publishing with MT.

This solves almost all my problems. Do you know a PHP plugin which allows to add abbr and acronym tags to known abbreviations & acronyms?

Thanks a lot again.

Arvind Satyanarayan said:
on Sep 9, 2004 8:09 PM | Reply

Hello Eduardo

I'm glad it is working for you. Until the plugins I mention in this entry are converted to PHP I unfortunately do not know of any plugins. If you (or anyone else) finds any plugin please do email me.

Dan Shannon said:
on Sep 10, 2004 10:03 AM | Reply

Hi there! Thanks for the plugins, but it seems that I'm breaking something or other. After dropping "modifier.textile2.php" and "Textile.php" into the proper folder (/MTDIR/php/plugins/) and switching to dynamic templates, I started getting this error: Parse error: parse error, unexpected TVARIABLE in /homepages/12/d88340789/htdocs/~danielsh/mt3/php/plugins/modifier.textile_2.php on line 3

Any idea what I might be doing wrong? Thanks!

Dan Shannon said:
on Sep 10, 2004 10:06 AM | Reply

Sorry, I didn't quite format that properly. The file names should be "modifier.textile_2.php" and "Textile.php" and the error message should read as follows:

Parse error: parse error, unexpected T_VARIABLE in
/homepages/12/d88340789/htdocs/~danielsh/mt3/php/plugins/modifier.textile_2.php on line 3

That looks a heckuva lot better :-). Thanks!

Arvind Satyanarayan said:
on Sep 10, 2004 10:49 AM | Reply

An updated version is on the way, sit tight I'm working on it!

Jason Mevius said:
on Sep 10, 2004 6:43 PM | Reply

That did the trick! Thanks..

Dan Shannon said:
on Sep 11, 2004 8:43 AM | Reply

It works beautifully! Thank you!

Joshua said:
on Sep 12, 2004 5:33 AM | Reply

Many thanks! You don't know how long I've been looking for something like this. Is there any chance you could convert MTEntryIfComments to PHP? The coding should be a lot simpler :/

Cheers!

Joshua said:
on Sep 12, 2004 11:34 AM | Reply

Thanks, but I don't think it works for what I want to do... it's more of an IF-THEN-ELSE thing. :/

Janus said:
on Oct 6, 2004 5:01 AM | Reply

Textile is working beautifully for me, but SmartyPants isn't doing anything. No errors, just no pretty quotes.

Janus said:
on Oct 6, 2004 5:22 AM | Reply

Ahh, didn;t have the tags modified as in the above post. Works now!

norlos said:
on Oct 17, 2004 4:32 AM | Reply

I usually wait til I've tried everything before asking the author directly, but I'm now officially 100% stumped. I've downloaded the PHP version of smartypants and modifier.smartypants (they both have a php extension), placed them in my MT-DIR/php/plugins folder, deleted the Perl smartypants plugin in the usual plugin folder, went through and changed all my smarty_pants="1" to smartypants="1" in all my templates. I also inserted this workaround. The result -- not only do I have non-smarty punctuation, smartypants still seems to be mucking up my individual entry pages. I get this error message:

Smarty error: [in mt:35 line 52]: syntax error: mismatched tag {/if}. (Smarty_Compiler.class.php, line 2211)

Any thoughts on what step I might be missing? I can't go back to static, since my blog appears to be too big to build without the connection to my web host bogging down. I can live with regular ol' punctuation marks, but it's not a pretty or comfortable life.

Any help is appreciated.

Tom said:
on Jan 14, 2005 4:48 PM | Reply

Thanks, Arvind, for taking trouble to do this, but Texttile's giving me a big headache.

After installing the plugin, I couldn't even render my page. Apparently Smarty was having an issue with my tag (the error message was similar to what norlos got above). With that tag removed, I can now see my page and Textile seems to be "working" except that it turned my utf-8 Thai-language entries into junk made mostly of grave-accented a's. The rest of the page (categories, entry titles etc), not formatted with Textile, displays correctly. So does a new entry with Textile turned off.

(Okay, when I say "the rest of the page", I should except which is having the same problem as the the entry body. Is it possible that Textile is somehow processing that tag althought I didn't tell it to?)

My page is a big illegible mess now. Unless there's fix, I would have to give up Textile altogether, which would be a total shame.

By the way, I also installed Smartypants and it's not doing anything--not working, but not causing trouble either.

Mike Steinbaugh said:
on Apr 16, 2005 11:42 PM | Reply

If you could change the call tag from smartypants="1" to smarty_pants="1", that would be awesome. Thanks! It's a tad bit annoying having to modify various client web sites when deploying dynamic publishing.

Jeroen said:
on Aug 30, 2005 5:20 PM | Reply

I installed smartypants, but have found two issues: 1. I use smartypants="2", which should change -- into an en-dash and --- into an em-dash, but it does not do that. It turns -- into an em-dash and processes --- as an em-dash and a normal dash. 2. It adds a space at the beginning of all output it processes. This invalidates my atom feed, which cannot be processed because of this error.

Horatio said:
on Sep 5, 2005 1:15 AM | Reply

Hello, I am having problems trying to install the php port of Markdown with SmartyPants, and having it work with MovableType 3.2 dynamic publishing. I believe the problem has to do with the directory that I am installing the php ports in. Here is a recap of the steps I took:

1. Got the following error when I turned on dynamic publishing in Movable Type 3.2: "Smarty error: [plugin] modifier 'markdown_with_smartypants' is not implemented (core.load_plugins.php, line 118)"

2. Googled for php-ports of markdown_with_smartypants, and found it here: "http://www.movalog.com/archives/dynamic/breaking-plugins/"

3. Downloaded and installed it in the following the following files: markdown.php smartypants.php modifier.markdown_with_smartypants.php into the following directory of my mt installation: mt/php/plugins

4. Still received the same error: "Smarty error: [plugin] modifier 'markdown_with_smartypants' is not implemented (core.load_plugins.php, line 118)"

5. So i browsed through the mt directory structure and tried installing the same files in the following directories: /php/extlib/smarty/plugins /php/extlib/smarty/libs/plugins /extlib/smarty/plugins

6. Still received the same error: "Smarty error: [plugin] modifier 'markdown_with_smartypants' is not implemented (core.load_plugins.php, line 118)"

7. I tried going back and checking permissions, setting them to 755, and still have not succeeded in getting it to work.

My questions are:

1. Am I installing these modifier plug-ins into the proper directory or directories?

2. If so, is there another step that I should take to activate the plugins?

3. Do you have any other suggestions that might help?

Thank you

Ian said:
on Sep 16, 2005 2:04 AM | Reply

Many thanks! i just installed Textile and your php files fixed it good :) should Brad know about this?

dcabo said:
on Mar 18, 2006 5:51 PM | Reply

I ran into problems when installing the provided Markdown/SmartyPants plugin with PHP 5.1.1. I was getting errors like:

pregreplacecallback() [function.preg-replace-callback]: Unknown modifier '|'

You can fix it by downloading an updated version of the Markdown PHP plug-in, as explained here http://warpspire.com/journal/programming/php-511-markdown-and-wordpress-kaboom/

Joshua Kaufman said:
on Nov 30, 2006 9:33 PM | Reply

Is PHP SmartyPants for MT still being developed? I installed the latest version above and am using smarty_pants="1" in my output tags, but it doesn't seem to do anything. However, no errors are occuring.

Leave a comment

Preview