Wednesday, August 31, 2022

[FIXED] How do you get multiple args in a PEAR BBCODE Parser?

Issue

Currently I am parsing my text using the PHP5 PEAR BBCode parser. Now I am looking into my img tag and realise I don't know how to specify 3 args. This is the format of the input:

[img src="" title="" alt=""]

And what I want to get out:

<img src="" title="" alt="">

I am currently using this code but I cannot access multiple arguments-

    'img'=>      array('type'=>BBCODE_TYPE_NOARG,
                'open_tag'=>'<img src="', 'close_tag'=>'" />',
                'childs'=>''),

Solution

BBcode does not have the concept of multiple attributes - you cannot do what you want.

Only single, unnamed attributes are supported:

[url=http://example.org]name[/url]


Answered By - cweiske
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.