Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-11-30 04:36:13

rayne
Member
From: AL USA
Registered: 2004-03-24
Posts: 58
Website

Use Textile in plugin

I’m trying to create a plugin for the image caption using code thrown together by Manticor. But I’d like to include an attribute so that if set, it will parse the caption through Textile.

I’m not sure how to get it to do this. I’ve tried a few things, but all I get is the captioin text, as it was entered. Can anyone point me in the right direction for getting a plugin to use Textile?

Thanks,
Rayne


Rayne
mama love

Offline

#2 2004-11-30 04:56:33

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Use Textile in plugin

Take a look in publish/comment.php around line 85 (or search for “new Textile()”).


Alex

Offline

#3 2004-11-30 05:01:03

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: Use Textile in plugin

This is probably what you are going for.

include_once $txpcfg['txpath'].'/lib/classTextile.php';
$textile = new Textile();
pre_textile = "This is some text that *will* be _textiled_";
$post_textile = trim(nl2br($textile->TextileThis($pre_textile,1)));

Note: I can’t prevent the forum from textiling the * and the _ which are show above with their html tags instead of their values.

Last edited by Manfre (2004-11-30 05:03:38)

Offline

#4 2004-11-30 05:04:54

rayne
Member
From: AL USA
Registered: 2004-03-24
Posts: 58
Website

Re: Use Textile in plugin

Thanks! I figured it out. I was missing a global variable.

I think I got it all worked out. I’m using it on my site without any problems.

Use <code><txp:rwt_image_caption /></code> to display the image caption. To parse the caption through Textile use <code><txp:rwt_image_caption usetextile=“1” /></code>

Download link


Rayne
mama love

Offline

Board footer

Powered by FluxBB