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

XF 1.3 Highlight Text BB Code

#1
Hello,

I finally took the plunge over the weekend, and purchased Xenforo. Been having fun with the set up, and this support forum is invaluable.

I am pretty good with finding answer, but have been stumped for more than a few hours with this one.

I am trying to find a way to just add highlighting (I guess another term is BG?) to BB Codes. I have visited this thread, and I tried to follow the directions, and I can't make it work, and don't know what I am doing wrong.

I have also been to the Custom BB Code Manager and just feel that is too much for me because all I really want to add is a Highlight Text BB Code.

Am I just whistling Dixie?

Can this simple thing be done in the Custom BB Code > Add New Custom BB Code

Help? Thanks!
 
#3
Well, I know it helped me! I got my highlight!!!

Thank you so much!!!

My question to you is this: in the second image in the area Editor Icon URL, I used exactly what you put there. I don't want to steal anyone's bandwidth. Is that something I can leave there or is it something I need to upload to my server?

Again, thanks.
 

Brogan

XenForo moderator
Staff member
#4
Change that to your style path.
The editor icon file is already on your server, in the default style and each additional style you use.
 
#6
The class defined is like so:

Code:
.ctaBbcodeBg
{
    padding: 1px 2px;
}
Hello again ... the highlighting is working just fine, however, I seem to be limited to certain colors. I have tried some Hex codes (because the default green and blue are way too dark) and they don't seem to work. I am wondering if the code above is something I need to add to get that to work?

If so, I am so sorry, but where do I put that? Thanks so much!
 

cclaerhout

Well-known member
#10
Why install a separate editor when it can be accomplished via the bbcode as mentioned above? Just curious.
Yes, an editor is "just" an interface and Bb Codes are managed by the XenForo parser and formaters. But the TinyMCE quattro has its own "highlight" Bb Code: "bcolor". Any other Bb Codes can be used as well but won't have the wysiwyg interface.
 

JamesBrown

Well-known member
#13
Any chance of an idiots guide to adding background colour function to the standard editor. I've tried to follow Brogan's example, but it assumes I'm not an idiot. Where do I define classes and choose colours etc.

Thanks
 

JamesBrown

Well-known member
#14
I still don't have a way of highlighting text. Should we really have to mess around with custom code edits and and CSS for such a simple editor function?
 

JamesBrown

Well-known member
#18
The HTML replacement is invalid and there should be no optional parameter if it is hard coded to yellow.

Thanks Brogan I initially copied it from your graphic and I've since tried every option. Running out of patience with this. I'll tray again later Hopefully it will be easier to achieve in xF2. Thanks anyway.
 
Last edited:
#19
Can anyone see where I'm messing up?
The items {option} and {text} are parameters that get replaced with whatever follows the '=' in the bbCode when used and whatever lies between the opening and closing bbCodes.

When you replace option with yellow in the bbCode definition, you are asking the software to give you the parameter "yellow" instead of the parameter "option" and yellow does not exist. I believe you want the code to always generate yellow in that example. If you leave off the curly brackets, that should work.

I am new here, so I am not sure why there is a class declaration in the bbCode definition. Since it is there in Brogan's example, I suspect it must be exactly the class that he declared since the class name needs to be recognized by the software.

I agree that the bbCode definition form is a bit intimidating. The example above helps quite a bit in the understanding if you know some of the basic rules of CSS and PHP.
 

Brogan

XenForo moderator
Staff member
#20
Since it is there in Brogan's example, I suspect it must be exactly the class that he declared since the class name needs to be recognized by the software.
My version allows for any colour to be used as the highlight/background, rather than a hard coded colour.

As you suggest, you can omit the option parameter and set the colour in the HTML replacement field, allowing just the tag to be used like so: [BG]Highlighted text[/BG]