Zend_Markup レンダラー Zend_Markup には現在ひとつのレンダラー、 HTML レンダラーが同梱されています。 自作のタグの追加 自作のタグを追加することによって、Zend_Markup レンダラーに 自作の機能の追加できます。 タグ構造とともに、 あなたが望むいかなる機能も追加ができます。 簡潔なタグから複雑なタグ構造まで。 'foo' タグでの単純な例: addTag( 'foo', Zend_Markup_Renderer_RendererAbstract::TYPE_REPLACE, array( 'start' => '-bar-', 'end' => '-baz-', 'group' => 'inline' ) ); // これは 'my -bar-tag-baz-' と出力されるでしょう。 echo $bbcode->render('my [foo]tag[/foo]'); ]]> あなたの作成したタグは、あなたのパーサーがタグ構造もサポートするときに 機能することに注意してください。現在、 BBCode はこれをサポートします。 Textile はカスタムタグをサポートしません。 Some renderers (like the HTML renderer) also have support for a 'tag' parameter. This replaces the 'start' and 'end' parameters, and it renders the tags including some default attributes and the closing tag. Add a callback tag By adding a callback tag, you can do a lot more then just a simple replace of the tags. For instance, you can change the contents, use the parameters to influence the output etc. A callback is a class that implements the Zend_Markup_Renderer_TokenInterface interface. An example of a callback class: Now you can add the 'upper' tag, with as callback, an instance of the My_Markup_Renderer_Html_Upper class. A simple example: addTag( 'upper', Zend_Markup_Renderer_RendererAbstract::TYPE_REPLACE, array( 'callback' => new My_Markup_Renderer_Html_Upper(), 'group' => 'inline' ) ); // now, this will output: 'my !up!TAG!up!' echo $bbcode->render('my [upper]tag[/upper]'); ]]> タグ一覧 タグ一覧 入力例 (bbcode) 出力例 [b]foo[/b] foo]]> [i]foo[/i] foo]]> [cite]foo[/cite] foo]]> [del]foo[/del] foo]]> [ins]foo[/ins] foo]]> [sup]foo[/sup] foo]]> [sub]foo[/sub] foo]]> [span]foo[/span] foo]]> [acronym title="PHP Hypertext Preprocessor]PHP[/acronym] PHP]]> [url=http://framework.zend.com/]Zend Framework[/url] Zend Framework]]> [h1]foobar[/h1] foobar]]> [img]http://framework.zend.com/images/logo.gif[/img] ]]>