Journal

4.0.3 Textile Fix

30 December 2005 › 4 comments

Well, it’s that time again. My favorite CMS, Textpattern has been updated to version 4.0.3, so I’m busy re-hacking things back to my liking. One of my pet peeves as of version 4.0.2 is that full Textile is now enabled for comments. While this is all well and good for the most part, it means that there are inconsistencies in formatting between previous and latter versions of TXP.

So, for sites like mine, that has been running TXP ever since RC1, there is quite a lengthy history of comments. To switch over to the new format now would mean having to go back and re-format all my old comments. This is not something I want to do. Aside from laziness, another reason the new comment formatting scheme doesn’t sit well with me is anyone can insert any Textile HTML element into comments, including headers and even tables.

To remedy this problem, I have tweaked the txplib_misc.php which is found in the /textpattern/lib/ directory. I sincerely hope that they provide for some sort of admin interface toggling option for comment handling in the future, but for now we can make-do by hacking the PHP to our liking. Here is a summary of the code changes that I’ve made in order to fix the formatting:

// Lines 1205 to 1210:

$msg = trim(
$textile->blockLite(
$textile->TextileThis(
strip_tags(deEntBrackets($msg)),1
),'',$im,'',(@$comment_nofollow ? 'nofollow' : ''))
);

// Replacement Code:

$msg = trim(
nl2br(
$textile->TextileThis(@
strip_tags(deEntBrackets($msg)),1,
'',$im,'',(@$comment_nofollow ? 'nofollow' : '')))
);

In case you are not comfortable hacking up your Textpattern installation, don’t sweat it. I have provided a replacement PHP file, along with some brief instructions. You can download them in a neat little Zip file here…

You will just need to replace this file with the old one. Though I have had no problems at all with this fix, I recommend backing up your old one, just in case. Please note, this is only for the Textpattern 4.0.3 release. If you are still running TXP 4.0.2, you will need to get the previous Textile Comments Fix.

Discussion + Dissension

  1. #1 Yannick

    hehe on the ball as usual Nathan. Thanks for alerting me of the update.

  2. #2 Nathan Smith

    Thanks Yannick. There is also an issue with the TXP comment form creating invalid code for hidden inputs. That discussion continues on the: TXP Forum.

  3. #3 Jeff Adams

    Hey Nathan, be sure to add this suggestion on the textpattern forums if you haven’t already. I don’t particularly want full textile available either. Thanks for the tweaks.

  4. #4 Nathan Smith

    Thanks Jeff. I made mention of it on the official version 4.0.3 announcement thread. I’m hoping that in future versions there are more ways to choose how Textile works. It seems like a pretty monumental change to just sneak into a point upgrade. Too bad it wasn’t better documented.

Comments closed after 2 weeks.

FYI


Member of 9rulesHosted by Mosso

Advertisement

Ads by SidebarAds

Latest Posts: All - RSS

My Book

Textpattern Solutions I had the privilege of co-writing Textpattern Solutions for the web technology publisher Friends of ED. If you want to develop a professional dynamic web site, without the hassle of writing all the server-side code from scratch, then Textpattern could be just the solution you are looking for.