Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-10 21:39:05

phual
Member
From: UK
Registered: 2008-02-19
Posts: 26
Website

[textile] Calling classTextile.php functions... what am I doing wrong?

I’ve got a simple little project that includes the need to display standard text stored in a database field as html. Given that it is so simple (no formatting, just line breaks), I figured that a simple solution was to use classTextile.php. Can I get it to work… can I heck!

All I’ve been able to find to instruction me on how to use the library is this link , which indicates that Textile() and TextileThis() are the only functions I should need.

So, what am I doing wrong in the simple test below?

<?php
include 'classTextile.php';

$text = 'Just to prove that we are here';
echo '<p>'.$text.'</p>';

$text = 'Are we still here... good';
TextileThis($text);

?>
I also tried with a couple of parameters (pinching it from line 761 of txplib_wrapper.php, 'cause I know that works).

Stuart

Offline

#2 2011-09-10 23:59:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Calling classTextile.php functions... what am I doing wrong?

The file, classTextile.php, contains a class called Textile, and the TextileThis() is a method. First create an instance of Textile, and then go from there.

$textile = new Textile();
$textile->TextileThis('I am Content.');

Offline

#3 2011-09-11 21:11:33

phual
Member
From: UK
Registered: 2008-02-19
Posts: 26
Website

Re: [textile] Calling classTextile.php functions... what am I doing wrong?

Thanks for the response. After a little while exploring my ignorance of the topic, I know understand. To be clear, the new working version of the above code is as follows:

<?php
include 'classTextile.php';

$text = 'Just to prove that we are here';
echo '<p>'.$text.'</p>';

$textile = new Textile();
$text = 'Are we still here... good';
echo $textile->TextileThis($text);

?>
Stuart

Offline

Board footer

Powered by FluxBB