Phenix_Wiki is a new component of the PhenixApp project. This component parse structured wiki text and render it into arbitrary formats such as XHTML.

How to use it with Factory method.

Factory methode returns a Phenix_Wiki Parser class for the specified parser

For Default parser :

1
2
$wiki = Phenix_Wiki::factory("Default");
echo $wiki->transform($text, 'xhtml');


For BBcode (with specified rules):

1
2
3
4
5
6
7
$rule = array('Prefilter', 'Delimiter', 'Code', 'Function', 'Html', 'Raw', 'Include', 'Embed', 'Anchor',
              'Heading', 'Toc', 'Horiz', 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image',
              'Phplookup', 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink',
              'Colortext', 'Strong', 'Bold', 'Emphasis', 'Italic', 'Underline', 'Tt', 'Superscript',
              'Subscript', 'Revise', 'Tighten');
$wiki = Phenix_Wiki::factory("Bbcode", $rule);
echo $wiki->transform($text, 'xhtml');


For Creole :

1
2
$wiki = Phenix_Wiki::factory("Creole");
echo $wiki->transform($text, 'xhtml');

How to use it with Singleton method

This avoids instantiating multiple Phenix_Wiki instances where a number of objects are required in one call, e.g. to save memory in a CMS environment where several parsers are required in a single page.

1
2
$wiki = Phenix_Wiki::singleton("Bbcode");
echo $wiki->transform($text, 'xhtml');

Where to find the component?

Web Repository : http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki
To access via SVN : svn://phenixapp-project.net/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki

Note that this first version is not recommanded for production.

Tags: , , , , , , , , , , , ,

Partager
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • RSS
  • Live
  • Technorati
  • Twitter
  • Blogosphere News
  • Yahoo! Bookmarks
  • LinkedIn

Related posts:

  1. Phenix_File_Parser_Csv
  2. Phenix_View_Helper_Text2image (English)
  3. Autocomplete field with Zend Framework and Dojo
  4. Add language route to your Zend Framework project.
  5. Phenix_View_Helper_Text2image

Tags: , , , , , , , , , , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">