PDA

View Full Version : How do you edit default bbcode?


indie2industry
07-24-2009, 03:30 PM
How do you edit default bbcode? I forgot how to do this :(

James Birkett
07-24-2009, 03:47 PM
If it's quote/code tags - look in the related template.
My forum has some SQL errors so I can't look for the other ones, sorry!

indie2industry
07-24-2009, 04:01 PM
it's the [img] bbcode I'm trying to edit.

--------------- Added 1248497420 at 1248497420 ---------------

no one knows??? Woooooooooooooooooooooooooooow :-(

Dismounted
07-25-2009, 04:47 AM
Modify the BB code handler for the IMG tag, then you can do whatever the hell you want in processing the tag.

M.C.
02-01-2012, 09:40 PM
yes but where I need to go to do it?

kh99
02-02-2012, 01:25 PM
I believe you would need to change the function handle_bbcode_img() in includes/class_bbcode.php.

doob
04-13-2012, 10:06 AM
kh99, is that the same place you'd go to change the alt text that appears for the default Insert Image button in forum posts, etc? doing a search for insertimage.gif and "Insert Image" doesn't uncover anything in that php document.

kh99
04-13-2012, 11:48 AM
That php file is only where bbcodes are processed. Using "search in phrases" I find a phrase with text "Insert Image", so that may be it (although I haven't tried it). Try adding a translation for that phrase.

doob
04-13-2012, 06:18 PM
Thanks for that sugg.

FYI. It seems that if you want to override the default behavior you just add a new custom bb code with the same name as a default one. ie to override the IMG tag, just create a new custom tag and name it IMG with whatever properties you want. Fun stuff!

kh99
04-13-2012, 07:58 PM
FYI. It seems that if you want to override the default behavior you just add a new custom bb code with the same name as a default one. ie to override the IMG tag, just create a new custom tag and name it IMG with whatever properties you want. Fun stuff!

Thanks, I didn't know that. I thought I had tried that and had it tell me that the code already existed.

doob
04-13-2012, 08:18 PM
Seems to be working, might be version dependent though? Interstingly it doesn't seem to entirely replace the default IMG behavoir, but puts mods on top of it.

Any idea what code snippit is responsible for the popup url browser generated by the insert link or insert image default buttons? And can that code be inserted in the custom bb code interface or does it have to be coded into the php doc?

I'm still looking into use of the {option} use and syntax so my answer may lie there...

kh99
04-14-2012, 04:53 PM
Seems to be working, might be version dependent though? Interstingly it doesn't seem to entirely replace the default IMG behavoir, but puts mods on top of it.

I think you're allow one with an option and one without - maybe that's what's going on?


Any idea what code snippit is responsible for the popup url browser generated by the insert link or insert image default buttons?

I believe that's a ckeditor custom extension, and so is probably somewhere under the clientscript directory.


And can that code be inserted in the custom bb code interface or does it have to be coded into the php doc?

Not sure what you're asking, but it sounds like I wouldn't be sure of the answer either. Maybe someone else will know...

demonlord
09-20-2012, 03:21 AM
anyone know how to change "alt" attribute in default img bbcode?

kh99
09-20-2012, 11:40 AM
anyone know how to change "alt" attribute in default img bbcode?

You should look at the code in function handle_bbcode_img(), in file includes/class_bbcode.php. In some cases the contents of the alt attribute comes from the phrases image_larger_version_x_y_z or image_x_y_z, so you may be able to do what you want by translating those phrases. Otherwise you'd probably need to edit the php code in that file.

demo7up
09-23-2012, 10:49 PM
I actually just did this in includes/class_bbcode.php look for the following function I added the red part to fit my forums fixed width.


function handle_bbcode_img_match($link, $fullsize = false)
{
$link = $this->strip_smilies(str_replace('\\"', '"', $link));

// remove double spaces -- fixes issues with wordwrap
$link = str_replace(array(' ', '"'), '', $link);

$retval = ($fullsize ? '<div class="size_fullsize">' : '') . '<img width="920px" src="' . $link . '" border="0" alt="" />' . ($fullsize ? '</div>' : '');

($hook = vBulletinHook::fetch_hook('bbcode_img_match')) ? eval($hook) : false;

return $retval;
}