1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 Using BBCodes?

Discussion in 'XenForo Questions and Support' started by JJJ, Mar 1, 2014.

  1. JJJ

    JJJ Active Member

    Nice, we have Custom BB Codes now. I think, that maybe could help me, to give our users some extended formatting features, like floating thumbnail-images, justified text and other things, that could make postings look nice.

    I know, there is Cédric's Advanced BBCodes Pack. But to let my users use that, it would need to get integrated into the editors toolbars and also would need some kind of interfaces, but this just seems possible with the TinyMCE, not with the Redactor editor I use. But I don't really want to use TinyMCE, because I think, Mike and Kier will have good reasons to use Redactor in XenForo.

    Somehow I'm a bit confused and don't really know, where and how to start integrating BBCodes in our forum. I would like to let my users use some of the features of Cédric's Advanced BBCodes Pack... what should I do?

     
  2. cclaerhout

    cclaerhout Well-Known Member


    The Bb Codes are working not matter what is the editor. I've just developed an interface for those with a framework from the TinyMCE Quattro addon. It makes article formatting easier for Editors. Don't think because you have these Bb Codes, users will start to use them. That will not happen. You need to select a few Editors and give them instructions on a private forum. You can use MCE only for this Editors usergroup and Redactor for others if you find TinyMCE less effective than Redactor.
     
  3. Mike

    Mike XenForo Developer Staff Member

    I unclear what the question is specifically. Since 1.3 has custom BB codes, you can just create the additional formatting options through that. If you supply information about an editor icon image, you can display an icon to insert the BB codes in the editor to aid discoverability.
     
  4. JJJ

    JJJ Active Member

    Thanks Cédric & Mike for the hints :)
    It seems, that I have to experiment and learn to find out, how it works.
     
  5. JJJ

    JJJ Active Member

    Wow, got it :)

    @Mike thanks, it actually is much easier than I thought it would be.

    Is there a way, to pack icons into dropdowns like there:

    Unbenannt.PNG
     
    Last edited: Mar 1, 2014
  6. Mike

    Mike XenForo Developer Staff Member

    There's no out of the box option to do that.
     
  7. JJJ

    JJJ Active Member

    I seem to have one more problem. I'm trying to create a BBCode to implement a Soundcloud-player. This seems easy, but still I can't get it running.

    my BBCode is:
    Code:
    [SC]https://soundcloud.com/ili84/traynor-clean[/SC]
    My HTML-Replacement is:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url={text}">
    <param name="allowscriptaccess" value="always">
    <embed allowscriptaccess="always" height="91" src="http://player.soundcloud.com/player.swf?url={text}" type="application/x-shockwave-flash" width="100%">
    </object>
    {text}
    ...and this should be converted to that HTML

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=https://soundcloud.com/ili84/traynor-clean">
    <param name="allowscriptaccess" value="always">
    <embed allowscriptaccess="always" height="91" src="http://player.soundcloud.com/player.swf?url=https://soundcloud.com/ili84/traynor-clean" type="application/x-shockwave-flash" width="100%">
    </object>
    But actually unfortunately it is replaced by:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=&lt;a href=" https:="" soundcloud.com="" ili84="" traynor-clean"="" target="_blank" class="externalLink" rel="nofollow">http://soundcloud.com/ili84/traynor-clean"&gt;
    <param name="allowscriptaccess" value="always">
    <embed allowscriptaccess="always" height="91" src="http://player.soundcloud.com/player.swf?url=&lt;a href=" https:="" soundcloud.com="" ili84="" traynor-clean"="" target="_blank" class="externalLink" rel="nofollow">http://soundcloud.com/ili84/traynor-clean" type="application/x-shockwave-flash" width="100%"&gt;
    </object>
    Somehow the included URL is parsed and converted to a HTML link in anker tags.

    If I check "Stop parsing BB-Bode" on the Advanced Options Tab, the following code is generated, which unfortunately doesn't work either:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=[url]https://soundcloud.com/ili84/traynor-clean[/url]">
    <param name="allowscriptaccess" value="always">
    <embed allowscriptaccess="always" height="91" src="http://player.soundcloud.com/player.swf?url=[url]https://soundcloud.com/ili84/traynor-clean[/url]" type="application/x-shockwave-flash" width="100%">
    </object>
    Can someone tell me, what I am missing? :eek:
     
  8. Mike

    Mike XenForo Developer Staff Member

    It won't be retroactive, but you need to disable auto linking within your BB code as well.
     
  9. JJJ

    JJJ Active Member

    Thanks @Mike. Works perfect now :)

    Seems that "It won't be retroactive" was the important hint.
     
  10. cclaerhout

    cclaerhout Well-Known Member

    If you need to do it for previous posts, you can still use this addon:
    http://xenforo.com/community/resources/post-content-find-replace.1549/

    And use these settings with it (only compatibly for Bb Codes that don't have nested Bb Codes inside their options):

    Search:
    Code:
    #(\[(bbcode_1|bbcode_2|bbcode_3)(?:=[^\]]+?)?\])\[url]([\s\S]+?)\[/url\](\[/\2\])#ui
    Replace:
    Code:
    $1$3$4
    You will have to replace bbcode_x with your real Bb Codes tag names and separate them with a |.

    Example:
    This code:
    Code:
    [bbcode_1][url]http://www.xenforo.com[/url][/bbcode_1]
    [bbcode_2][url]http://www.xenforo.com[/url][/bbcode_2]
    [bbcode_3=abc][url]http://www.xenforo.com[/url][/bbcode_3]
    
    Will be transformed to:
    Code:
    [bbcode_1]http://www.xenforo.com[/bbcode_1]
    [bbcode_2]http://www.xenforo.com[/bbcode_2]
    [bbcode_3=abc]http://www.xenforo.com[/bbcode_3]
    
     
  11. JJJ

    JJJ Active Member

    Thanks Cédric. But for the Moment it works fine.
     

Share This Page