ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Custom BB tags in Discussion Forum?

October 18, 2010 7:51pm

Subscribe [3]
  • #1 / Oct 18, 2010 7:51pm

    C. Reeves

    20 posts

    First off, I’m using EE v1.6.9 and Discussion Forum v2.1.1. I realize some folks will suggest I upgrade to EE 2.0.1 but it’s just not in the budget right now.

    As for my question, I’m wondering if there’s a place somewhere in the EE or forum system, or perhaps in the files on the server, to create new custom formatting tags that all users can use. Examples of what I’m talking about would be ordered/unordered lists and spoiler text (ie. [spoiler]text to be hidden[/spoiler])

    Creating a spoiler text tag has been something that’s been highly requested on my forum, so I’m trying to see if that’s even feasible. I’m going for something that is similar in functionality to the way vBulletin does it, where it uses a sort of show/hide div effect to hide or reveal whatever content is between the spoiler tags.

    Is this possible? If so, where would I go to add in new tags?

    Any help is appreciated! Much thanks!
    -Chris

    Moved to CodeShare Corner by Moderator

  • #2 / Oct 19, 2010 9:28am

    Sue Crocker

    26054 posts

    Hi, Chris. You’d need to make changes to the core.typography.php file, and search for decode_pmcode found around line 757. NOTE: This is just enough information to get you started. It’s not meant to be a final solution. Does that help?

  • #3 / Oct 19, 2010 11:04am

    C. Reeves

    20 posts

    I’ll take a look at this later today and get back to you. It’s a place to start anyway! 😊

    Thanks for your reply!

    -Chris

  • #4 / Oct 19, 2010 3:38pm

    Ingmar

    29245 posts

    Very good. We’ll be here, just keep us in the loop, please.

  • #5 / Oct 19, 2010 9:59pm

    C. Reeves

    20 posts

    Hmm… this kind of hurts my brain! Honestly, I’m more of a designer than a developer and I may be getting in over my head on this since my PHP-Fu is weak. I’ll get a buddy of mine to help me with the heavy duty PHP stuff.

    So if I add the appropriate new decode code to the decode_pmcode function, will this automatically add a new button for the new pmcode tags to the UI or is that done elsewhere?

  • #6 / Oct 20, 2010 7:52am

    Sue Crocker

    26054 posts

    I agree it does hurt the brain. You do bring up another way of handling this - which is to build out a new pmcode button for everyone. I have one I add for Question and Answer formatting. I’m not sure if that would fit what you’re looking to do.. but we’ve reached HowTo stage, so will move to the CodeShare forum.

  • #7 / Nov 04, 2010 1:03pm

    C. Reeves

    20 posts

    Ok, I’ve finally had some time to work on this again. Here’s what I was able to come up with.  Please keep in mind this is a very basic example. With a bit of tweaking one could easily customize my code to use nicer looking buttons or formatting but this will get folks started.

    First, as noted in previous posts, locate /system/core/core.typography.php and open it. Then, scroll down to below the /**  Style tags part and add the following…

    /** -------------------------------------
    /**  Spoiler tag
    /** -------------------------------------*/
                    
            $str = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/si", "<div  margin-top:5px\"><div class=\"quotetitle\"><input class=\"button2 btnlite\" type=\"button\" value=\"View Spoiler\" ><div class=\"quotecontent\"><div  none;\">$1</div></div></div>", $str );

    There you have it, a bbcode spoiler tag! You would use it like so…

    [spoiler]content you wish to have hidden[/spoiler]

    What using this code does is insert an input button in the body of your forum post. When clicked, it reveals the hidden content below it. You can hide the content by clicking the input button again.

    Now the next step is to add a button to the default UI for this. I know you can edit the default UI buttons for the main EE publishing module by going to CP Home >> Admin >> Weblog Administration >> Default HTML Buttons. But I don’t know where or how to achieve the same thing for the forum.  I could use some help on that part!

    Cheers, and enjoy the code!
    -Chris

  • #8 / Nov 09, 2010 12:19am

    C. Reeves

    20 posts

    Bump!

    I could still use some help on making custom buttons. Does anyone have any ideas on this?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases