1.3 Custom BB Codes

Thảo luận trong 'Have you seen...?' bắt đầu bởi VXF, 23/1/14.

5/5, 1 vote

  1. VXF

    VXF Be like no other .. Staff Member

    Bài viết:
    Likes :
    Some of you may have spotted this in a previous Have You Seen, but today we're going to look at XenForo 1.3's custom BB code support in detail.

    At a high level, custom BB codes let you define BB codes to fit your site's needs. This allows you to give your users more options for mark up, without opening up arbitrary HTML and the various issues (security and otherwise) that come with that. A BB code may take an "option" parameter if needed, such as in ....

    Basic Options

    Let's look at the main BB code creation form. It's a biggie:

    This is just the "basic" fields. We'll get into the advanced stuff in a bit.

    Many of these fields should be self explanatory. The title/description mostly relate to the help page, as well the example. Otherwise, you define how the tag is used -- if it takes an option or not (or optionally) and how the HTML replacement is done. If you wish to callback to a PHP file, you can.

    Another option to note is the control over whether this BB code can be used in signatures. While custom BB codes don't have the full control of signature permissions like the standard codes, this can be used to limit certain codes in signatures to prevent abuse.

    Advanced Options

    Now, we have a bunch of other options which you don't necessarily need to adjust:

    On the advanced page, you can limit the option to expected formats. This is used in color, font, and size tags for example. You can also change the parsing rules within the tag, such as disabling smilies and other BB codes; you can see this in the
     tag for example.
    You can also add an icon to the editor to make it easier to add your code. If you've configured smilies, you'll be familiar with these options. (Note that this will just add a simple icon that when clicked makes it easy to insert the tag; more extensive integration would require custom JavaScript.)
    Finally, in a few rare cases, you might want to use specific alternative replacements based on the context. Notably, this can be done in HTML emails (by default, the quote tag is different) or when rendering to pure text (quotes and images are different, amongst other things).
    [B]Add-ons, Importing, and Exporting[/B]
    You might have noticed the option to select an add-on on the BB code creation form. Like various other types of content, you can assign a custom BB code to an add-on and it will be created when the add-on is installed and remove when it's uninstalled. (This is only available in debug mode.)
    However, like smilies, a selection of BB codes can also be individually exported and then imported, independent of the add-on system. This should make sharing BB codes (or BB code sets) easier. (Note that BB codes that are attached to an add-on cannot be exported independent of the add-on.)
    While this is certainly not a revolutionary feature, we're sure this will give admins more control over their site and allow you and your users to format messages the way you want.

    Các file đính kèm:

    Đang tải...
  2. Kid

    Kid VIP Member

    Bài viết:
    Likes :
    Em dùng thử phần này. Em ko muốn dùng thẻ Font, Color, B...
    Có thể thêm Custom BBCode với giá trị BB Code TagB để ghi đè thẻ B có sẵn của XenForo.
    Cách làm này đã có tác dụng rồi. Tuy nhiên cách này vẫn chưa hay vì ko thay đổi đc nút ở thanh Editor.
    Anh @Alucar hoặc ai có thể chỉ giúp em cách xóa hẳn 1 nút ở thanh editor mà ít phải sửa code và ko ảnh hưởng đến bài viết cũ đc ko ạ.
    hacobi1102 thích bài này.
  3. hacobi1102

    hacobi1102 Member

    Bài viết:
    Likes :
    Thử mò css coi nó ẩn được ko
comments powered by Disqus

Chia sẻ trang này

Đang tải...