| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.markup.renderers">
- <title>Zend_Markup Renderers</title>
- <para>
- <classname>Zend_Markup</classname> is currently shipped with one renderer, the
- <acronym>HTML</acronym> renderer.
- </para>
- <sect2 id="zend.markup.renderers.add">
- <title>Adding your own tags</title>
- <para>
- By adding your own tags, you can add your own functionality to the
- <classname>Zend_Markup</classname> renderers. With the tag structure, you can add about
- any functionality you want. From simple tags, to complicated tag structures. A simple
- example for a 'foo' tag:
- </para>
- <programlisting language="php"><![CDATA[
- // Creates instance of Zend_Markup_Renderer_Html,
- // with Zend_Markup_Parser_BbCode as its parser
- $bbcode = Zend_Markup::factory('Bbcode');
- // this will create a simple 'foo' tag
- // The first parameter defines the tag's name.
- // The second parameter takes an integer that defines the tags type.
- // The third parameter is an array that defines other things about a
- // tag, like the tag's group, and (in this case) a start and end tag.
- $bbcode->addTag(
- 'foo',
- Zend_Markup_Renderer_RendererAbstract::TYPE_REPLACE
- | Zend_Markup_Renderer_RendererAbstract::TAG_NORMAL,
- array(
- 'start' => '-bar-',
- 'end' => '-baz-',
- 'group' => 'inline',
- )
- );
- // now, this will output: 'my -bar-tag-baz-'
- echo $bbcode->render('my [foo]tag[/foo]');
- ]]></programlisting>
- <para>
- Please note that creating your own tags only makes sense when your parser also supports
- it with a tag structure. Currently, only BBCode supports this. Textile doesn't have
- support for custom tags.
- </para>
- </sect2>
- </sect1>
|