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: BBcode, componant, Creole, Liens sur Zend Framework, parser, parser class, phenix, Phenix_Wiki, render, singleton method, superscript, Wiki, XHTML
Related posts:
- Phenix_File_Parser_Csv
- Phenix_View_Helper_Text2image (English)
- Autocomplete field with Zend Framework and Dojo
- Add language route to your Zend Framework project.
- Phenix_View_Helper_Text2image
Tags: BBcode, componant, Creole, Liens sur Zend Framework, parser, parser class, phenix, Phenix_Wiki, render, singleton method, superscript, Wiki, XHTML