Joomla Markdown Extension

As a result of a request from a reader of this blog, I have prepared a new Joomla extension which I have christened “jMarkdown” to partner with jTextile. Why would I do this? Well I remain absolutely convinced that even the best of the WYSIWYG editors for blogs and CMS are basically useless when it comes to editing text or restyling content. Wherever possible I use “Textile markup”:http://textism.com/tools/textile/ for content intended for publication via the HTML. This is a matter of personal preference, many others use “Markdown”:http://daringfireball.net/projects/markdown/. Elsewhere in this blog you’ll find jTextile, a Joomla 1.5 extension which supports the textile syntax

Anyway, jMarkdown allows you to prepare articles for Joomla 1.0 using the “Markdown”:http://daringfireball.net/projects/markdown/ syntax. jMarkdown, when activated, will convert the text into html for display purposes.

You can download jMarkdown “here”:http://s3.amazonaws.com/files.4results.biz/jMarkdown.zip. This is a prerelease version and does not include any documentation. Just install the extension and activate the plugin in your Joomla 1.5 site.

As usual feel free to comment or ask questions here.

Flex2 shipping module for VirtueMart on Joomla

Just a quick post here to say that I have released a VirtueMart shipping module for Joomla 1.5.

Suffice to say that it provides a flexible mechanism for calculating shipping with separate scales for “Domestic” and “International” orders.

The idea for this module, plus core source code, was derived from an existing module “flex” by Micah Shawn which is contained in the current VirtueMart distribution.

You can download the module from HERE. Installation instructions are in the included README file.

Joomla Textile Plugin

During the process of migrating a large Joomla site from 1.0 to 1.5 I ran into a problem. As usual with any sites with user editable content, I had steered away from using a WYSIWYG editor (I’ve yet to find one that actually works!) and have used Textile to format the content.

However, some serious Googling did not reveal a plugin for Joomla 1.5 to render the content. The original “mos Textile” mambot has disappeared and “rok Textile” does not work on 1.5

So I have lashed together a Joomla 1.5 plugin which will render textile markup correctly (including SmartyPants extensions).

Extension details:

  • I’ve called the plugin jTextile
  • It’s a BETA release
  • There is no documentation
  • There are no configuration options
  • It works on the content only
  • It is based on the work of others, thanks to their efforts
  • It can be downloaded from here

If there is any interest from out there, I’ll extend and support the plugin. Feel free to post comments or questions in this blog.

Textile Markup with MediaWiki, Revisited

Following Jim Wilson’s comment I have revisted this subject and now offer my own extension which adds Textile2 to the AlternateSyntaxParser without the need for hacking Jim’s original extension.

You can download the extension here.

Instructions are included in the source, but for convenience, they are repeated here…

*Installation:*

# Install the *AlternateSyntaxParser* extension.
# Drop this script (@AlternateSyntaxParserTextile2.php@) into @$IP/extensions/AlternateSyntaxParser@
# Enable the extension by adding this line to your @LocalSettings.php@:
@require_once(‘extensions/AlternateSyntaxParser/MarkdownSyntax.php’);@
after the line enabling the AlternateSyntaxParser
# “Download the Textile2 library”:http://jimandlissa.com/project/textilephp
# Extract the file @classTextile.php@ from the downloaded archive.
# Drop @classTextile.php@ into @$IP/extensions/AlternateSyntaxParser/@

*Usage:*

To use Textile2 in a page, put @#MARKUP textile2@ at the top of the page:

Alternatively, you may specify a site-wide default alternate language by setting the @$wgAlternateSyntaxParserLanguage@ variable in your @LocalSettings.php@.

$wgAlternateSyntaxParserLanguage = ‘textile2’;

Using Textile Markup with MediaWiki

“MediaWiki”:http://www.mediawiki.org/ is used extensively for documentation sites simply because it has so many features that make it ideal for this type of wiki application. The primary example is, of course “Wikipedia”:http://en.wikipedia.org

Naturally, I want to use MediaWiki for my own documentation sites. However, I use “Textile – a lightweight, humane web text generator”:http://thresholdstate.com/articles/4312/the-textile-reference-manual almost exclusively wherever HTML markup would otherwise be used. Also, I have to admit that I find the built-in MediaWiki markup verbose, ugly and counter-intuitive.

So, I was pleased to find a well written and documented MediaWiki extension which provides for alternative parsers, including textile. For some reason, the standard extension does not work on my sites. What I describe here is a simple mechanism to replace the TextilePHP parser with the Textile2 parser.

h3. Step One

Install the MediaWiki “AlternativeSyntaxParser extension”:http://jimbojw.com/wiki/index.php?title=AlternateSyntaxParser_Extension. Test it and if it works for you you’re done!

h3. Step 2

If the basic installation does not work, or if you want to try Textile2, add the following lines to @AlternativeSyntaxParser.php@ at about line #153

 case 'textile2':
    require_once('classTextile.php');
    $textile = new Textile();
    $text = $textile->TextileThis($parser->mSwappedOutText);
    break;

h3. Step Three

Download the Textile2 source from “here”:http://textile.thresholdstate.com/file_download/2/textile-2.0.0.tar.gz& and copy the file @classTextile.php@ to the same directory where the alternative parsers are.

h3. Step Four

Actually, you’re done! You now have another alternative parser ‘textile2’ available.

Once you have installed this, the editor buttons are no longer useful… maybe I’ll integrate “TheEditorHelper”:http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper/demo unless someone else gets it done first.

PHP 4.4.5 segfault fix

Quick tip for those of us unfortunate enough to have to deal with “legacy” php code (Ruby is Sooo much easier!).

One of my ISPs recently upgraded the PHP installation to 4.4.5 and suddenly my php application stopped. Nothing in the error log, no output to the browser.

I discovered that an attempt to @session_register@ an unitialised variable causes that build of PHP to segfault.

For example…

Will cause a segfault

<?php
session_start();
session_register("logon");
?>

No segfault

<?php
session_start();
$logon = "fred";
session_register("logon");
?>

I do not know if this is a generic issue or a consequence of the particular ISP’s build. But, I hope that this will help anyone else whose PHP application mysteriously stops!