Query: bbcode_add_smiley
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
BBCODE_ADD_SMILEY(3) 1 BBCODE_ADD_SMILEY(3) bbcode_add_smiley - Adds a smiley to the parserSYNOPSISbool bbcode_add_smiley (resource $bbcode_container, string $smiley, string $replace_by)DESCRIPTIONAdds a smiley to the parserPARAMETERSo $bbcode_container - BBCode_Container resource, returned by bbcode_create(3). o $smiley - The string that will be replaced when found. o $replace_by - The string that replace smiley when found.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 bbcode_add_smiley(3) usage example <?php /* * Prepare the rule set */ $arrayBBCode=array( ''=> array('type'=>BBCODE_TYPE_ROOT, 'childs'=>'!i'), 'b'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<b>', 'close_tag'=>'</b>'), 'u'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<u>', 'close_tag'=>'</u>', 'flags'=>BBCODE_FLAGS_SMILEYS_OFF), 'i'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<i>', 'close_tag'=>'</i>', 'childs'=>'b'), ); /* * Parsed Text */ $text=<<<EOF [i] No parse Test [/i] :) [b] Parsed, with smiley :( [/b] [u] Parsed, with no smiley :D [/u] EOF; /* * Init the parser */ $BBHandler=bbcode_create($arrayBBCode); /* * Add Smiley rules to parser */ bbcode_add_smiley($BBHandler, ":)", "<img src="smiley.gif" alt=":)" />"); bbcode_add_smiley($BBHandler, ":(", "<img src="sad.gif" alt=":(" />"); bbcode_add_smiley($BBHandler, ":D", "<img src="happy.gif" alt=":D" />"); bbcode_add_smiley($BBHandler, ":p", "<img src="tong.gif" alt=":p" />"); bbcode_add_smiley($BBHandler, ":|", "<img src="special.gif" alt=":|" />"); bbcode_add_smiley($BBHandler, ":6:", "<img src="six.gif" alt=":6:" />"); /* * Parse the text */ echo bbcode_parse($BBHandler,$text); ?> The above example will output: <i> No parse Test </i> <img src="smiley.gif" alt=":)" /> <b> Parsed, with smiley <img src="sad.gif" alt=":(" /> </b> <u> Parsed, with no smiley :D </u> PHP Documentation Group BBCODE_ADD_SMILEY(3)
Related Man Pages |
---|
img(n) - suse |
template::plugin::image(3) - suse |
tk::animation(3) - centos |
bbcode_set_flags(3) - php |
template::plugin::image(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
Replace text in multiple files |
Need to add colons |
Command-line tool for .gif files |
Remove external urls from .html file |
alt print screen problems |