| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2011-03-29 08:41 UTC] xdecock at gmail dot com
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 05:00:01 2025 UTC | 
Description: ------------ It would be very nice, if you could specify a callback for bbcode tags. This would be very useful for example for a forum etc. where you add a post-id as argument for the "quote" tag. With a callback you could handle the argument and fetch further information of the quoted text, e.g.: author-name etc. Reproduce code: --------------- <?php $string = <<<EOT [quote=1234] some-quoted-text [/quote] some more text EOT; $bbcode = array( '' => array( 'type' => BBCODE_TYPE_ROOT ), 'quote' => array( 'type' => BBCODE_TYPE_OPTARG, 'open_tag' => function(arg) { // do some stuff here like DB lookups etc, to get additional information for specified argument return "<blockquote><a href="...">" . $author_name . "</a></blockquote><br />"; }, 'close_tag' => '</blockquote>' ) ); $bbhandler = bbcode_create($bbcode); bbcode_parse($bbh, $string); ?> Expected result: ---------------- <blockquote><a href="...">author_name</a><br /> some-quoted-text </blockquote> some more text