Posted on 22/3/06 by Felix Geisendörfer
The authors of this post have marked it as deprecated. This means the information displayed is most likely outdated, inaccurate, boring or a combination of all three.
Policy: We never delete deprecated posts, but they are not listed in our categories or show up in the search anymore.
Small Update: I just uploaded a picture of the Textile-powered documentation frando and me are working with which you can take a look at here.
Today I want to speak about my favourite markup, Textile. It's a very intuitive, easy to learn markup that is used to generate valid (x)html. The most awesome aspect about it is that you can stay very simple with it, but generate very complicated pages as well.
For those who don't know about it yet, just check this link here. It has sample textile which you can change and display to try out things. It also is the website of project Textpattern which was the project to invent Textile.
Well, but since then Textile has been ported to different languages (like Ruby and Perl) and cloned several times. One of those php-clones is the Textile version I'm using right now, since I think its the best one of the ones out there. It's called TextilePHP and can be found here. For questions concerning the syntax check out the documention.
If you still doubt you could create all contents of a page using textile, check out my current webdesign site fg-webdesign.de, it is powered entirely by Textile and it's a pleasure to work with. Another project I'm doing a lot of Textile for is SpliceIt! or to be more exact, it's documenation. Frando and I wrote a nifty little Script that would allow us to write the entire docs in Textile but view them as Html in the browser. It even has build-in support for theming. If you are still looking for a documentation alternative feel free to take a look at it in our SVN Repository.
So but since I like to SoftHack everything I get in my fingers I found one thing that really annoyed me about textile - the fact that you can't create links that would open in a new window. So in order to make all external links automatically open in a blank window I've written a little class that adds this behavior:
* This functions overwrites the old format_link function
* It implements support for opening external Urls in a new window
* @param array $args
* @return string
$tag = parent::format_link($args);
$tag = $this->__split_html_tag($tag);
$url = $tag['options']['href'];
// This checks if the url starts with http or ftp which would mean it's an external url!
list($type) = explode('://', $url);
if (in_array($type, array('http', 'ftp')))
$tag['options']['target'] = '_blank';
* This function takes a complete (enclosed) Html Tag and splits it into it's peaces
* This is usefull for manupulating Html Tags
* @param string $tag
* @return array
$regex = '/\<([a-z]) ?(.*)\>(.*)\<\/[a-z]+\>/iUs';
preg_match($regex, $tag, $matches);
$return['name'] = $matches;
$return['innerHTML'] = $matches;
$params = $matches;
$regex = '/(([a-z]+)="(.*)" ?)+/iUs';
preg_match_all($regex, $params, $matches);
$params = array();
for ($i=0; $i<count($matches); $i++)
$params[$matches[$i]] = $matches[$i];
$return['options'] = $params;
* This functions takes an array that was split by __split_html_tag and puts it back together
* @param array $tag
* @return string
$params = "";
foreach ($tag['options'] as $key => $val)
$params = $params.' '.$key.'="'.$val.'"';
I hope some people now convert to Textile as I did, because I really think it's the way to go ; ). While it might be a little bit too complicated for Joe-Average I think it's really great for sites run by people that got tired of writing Html by hand, or fidling with bad WYSIWYG-editors. It's also very nice for all of you who feel dedicated to make W3C compliant pages.
Felix Geisendörfer aka the_undefined
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.