I just added some custom BBCodes to the subs.php file (I'm using 2.0 RC2) and they work great. However, I'm not sure how to have an icon show up in the reply area. What should I do?
You need to add code to Subs-Editor.php to achieve that. Best thing I can suggest is looking at the code below:
// The below array makes it dead easy to add images to this control. Add it to the array and everything else is done for you! in that file.
One example:
array(
'image' => 'bold',
'code' => 'b',
'before' => '[b]',
'after' => '[/b]',
'description' => $txt['bold'],
),
Each new tag will be an array( ) block like that, with the items referring to:
image -> the .gif in Themes/yourtheme/images/bbc that matches this button
code -> an identifier, should be the bbcode you are matching up
before -> the code to add before the cursor, usually the start tag
after -> the code to add after the cursor, usually the end tag
description -> the mouseover text, which is normally defined in the language files, if you don't need to make it multilingual, you can just add the text right there in quotes.
Thank you so much! Worked like a charm.
How would you achieve this in SMF 1.1.19?
Manually hack up the code in Post.template.php for each theme you use. Or consider that later this year 1.1.19 will stop receiving updates and plan for a move to 2.0
Thanks.
I added a code to Subs.php:
array(
'tag' => 'xxpgn',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', 'global $txt; $data = strtr($data, array(\'<br />\' => \'\', \'"\' => \'"\')); $tag[\'content\'] = \'<iframe height="400" width="920" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://87.118.113.44/pgn4web-2.46/board.html?a=f&delay=1000&l=f&pieceFont=alpha&pieceSize=30&squareSize=40&lch=EFF4EC&dch=C6CEC3&bbch=000000&hch=DAF4D7&sb=t&showHeader=t&showMoves=t&textMargin=20&fhch=000000&fontHeaderSize=80pct&fmch=000000&fvch=800000&fcch=396184&hmch=C6CEC3&fontMovesSize=80pct&fontCommentsSize=80pct&sc=t&scosl=f&bch=F0F0F0&highlightMode=border&framePadding=20&horizontalLayout=t&fh=board&fw=page&pt=\' . $data . \'">\' . $txt[\'pgn_no_iframe\'] . \'</iframe>\';'),
),
And it works.
Now I wanted to see an icon so I edited Post.template.php and added after "flash" icon:
'flash' => array('code' => 'flash', 'before' => '[flash=200,200]http://', 'after' => '[/flash]', 'description' => $txt[433]),
'xxpgn' => array('code' => 'xxpgn', 'before' => '[xxpgn]', 'after' => '[/xxpgn]', 'description' => $txt[454]),
but I still see no icon. :-(
I also copied xxpgn.gif to Themes/default/images/bbc.
Am I doing something wrong?
If you're not using the default theme you still have to put the icon into your theme... And modify your there's post template if it has one.
Also, don't say I didn't warn you when we stop supporting 1.1.x.
Lainaus käyttäjältä: Sir Cumber-Patcher - tammikuu 13, 2014, 11:10:11 AP
If you're not using the default theme you still have to put the icon into your theme... And modify your there's post template if it has one.
Also, don't say I didn't warn you when we stop supporting 1.1.x.
Yes, I've been warned, but no time to upgrade for now.
I am using the default theme. What could I miss?