Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

Topics must relate to a currently supported version of Kunena. If you are unsure what is the current supported version of Kunena, please go to the download page.

If you are having problems then, for your own benefit, it would save us all a lot of time if you would kindly post your configuration report when you ask for help from this forum. If you do not post your configuration report we will not ask you for it but you will probably not get your problem solved, either.

Question Create new BB-Code-Function

More
6 years 8 months ago #1 by Razen
I would like to create a new BB-Code-Function.

Basically it extract some information from the text between the tags via regex and display it within another position. The rest of the text is displayed normally.

On which positions do I have to create new stuff to do something like this?

Thanks a lot :)

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #2 by Razen
Replied by Razen on topic Create new BB-Code-Function
Anybody knows about this?

I tried a lot of stuff, searched the forum and the only thing I found was a highly outdated tutorial in a language I dont speak:
www.kunena.org/forum/38-italian/28850-ic...ella-boardcode#30004

A modification of an existing tag (the center-tags for example) would also do it...
thx a lot :)

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #3 by rich
Replied by rich on topic Create new BB-Code-Function
Check this file "components/com_kunena/template/crypsis/assets/js/markitup.editor.js"

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago - 6 years 8 months ago #4 by Razen
Replied by Razen on topic Create new BB-Code-Function
Ok I added a new button there and if you press it, the new bb-code is shown in the textarea. Now to I give the new button an image and how to I modify the display of the content? I see the bb-code files in the layout, but how are they used?

And I would like to work with the content beside the new created tags, so I would need that as a variable.

Thx :)

Edit:
I also changed the libraries/kunema/bbcode/bbcode.php-file, added a new function for the bbcode and a new entry in the class KunenaBbcodeLibrary. So now the givecode work - just the icon is still missing.
Last edit: 6 years 8 months ago by Razen.

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago - 6 years 8 months ago #5 by Razen
Replied by Razen on topic Create new BB-Code-Function
Ok I finally found out everything to add a new BB-Code.

Tutorial to add a new BB-Code-Button on Joomla 3 / Kunema 5

Since I couldnt find a tutorial how to do this in version 5.0.10 I do a rough tutorial here. This tutorial is for a new button which just inserts tags, not for a new button which opens a new widget to fill out. Since I only know basics about JS and PHP, the wording might not be 100% correct, but the information should be enough to get the idea:

1. Add a new button:
- Go to the file "components/com_kunena/template/[yourtemplate]/assets/js/markitup.editor.js"
- within the first 20 lines, you see the rough buttons and what they should insert. Add a new class in which position you want:
Code:
{className: 'givecode',name: 'Givecode',name: 'Givecode',openWith: '[gc]',closeWith: '[/gc]'},

Result: An empty slot in the BB-Code editor. If you click on it, the tags are inserted.

2. Add the image:
- Go to the file "media/kunema/cache/[yourtemplate]/css/kunema.css"
- starting at line ~990, you find the CSS for the buttons. Add a new one with the name of your new button:
Code:
#kunena.layout .markItUp .givecode a { background-image: url(/components/com_kunena/template/[yourtemplate]/assets/images/givecode.png); }
- obviously you've to upload the new icon in the right folder :)

3. Add the different view you want for the BB-Code:
- Go to the file "libraries/kunema/bbcode/bbcode.php"
- starting at line ~400, you seen arrays for every bb-button in the class KunenaBbcodeLibrary. Create a new array:
Code:
// Razen: Add givecode 'gc' => array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => 'DoGiveCode', 'allow' => array( 'type' => '/^[\w]*$/', ), 'class' => 'code', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_VERBATIM, 'before_tag' => "sns", 'after_tag' => "sn", 'before_endtag' => "sn", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ),
I also didnt understand everything in there, I just copied the one of a similar bbcode and modified it. The method name will be important for the next step
- later in the file, you find functions, called like the "method" in the array. Create a new one - the look of the bb-code should be in the return-value. I recommend to check some other functions to see what's possible...

This tutorial is surely not perfect, but it's the best I could do and I hope it will help some people. If youÄve something to add, you're welcome!
Last edit: 6 years 8 months ago by Razen.

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #6 by rich
Replied by rich on topic Create new BB-Code-Function

2. Add the image:
- Go to the file "media/kunema/cache/[yourtemplate]/css/kunema.css"
- starting at line ~990, you find the CSS for the buttons. Add a new one with the name of your new button:

Code:
#kunena.layout .markItUp .givecode a { background-image: url(/components/com_kunena/template/[yourtemplate]/assets/images/givecode.png); }
- obviously you've to upload the new icon in the right folder :)


Step 2 is not optimal. The css file in the cache is only temporary. Add instead following code in your custom.less

Code:
.markItUp .givecode a { background-image : url(assets/images/givecode.png); }
The following user(s) said Thank You: Razen

Please Log in or Create an account to join the conversation.

Time to create page: 0.556 seconds