miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
News & Announcements miniBB Support Forums / News & Announcements /   

Solution added: Automatic script tabbing ([script]...[/script] BBCode)

Author Team
#1 | Posted: 16 Nov 2005 02:38 | Edited by: Team 
This is a solution for automatic code tabbing in miniBB posts. It adds a new BBcode
[script]....[/script] - everything in between these tags will be tabbed automatically
based on { ... } so called "begin" and "end" programming language constructs.

$post_word_maxlenght (the variable from the setup_options.php file used to determine the maximum word
length) based wordwrapping will be applied to everything inside the tabbed script paragraph. Lines longer
than the $post_word_maxlenght value will be splitted!

The algorythm is simple - it adds spaces/tabs once a { symbol is found on the line and deducts spaces once the } symbol is found. Of course, the algorythm could be more precise and complicated, but we wanted it simple. Any suggestions on how to make this thing more "intelligent" without dramatical performance decrease are welcome.

Check it in action in our test forums here .

Author lime
#2 | Posted: 16 Nov 2005 04:22 
Hmm I just tried it and I'm not sure if it's because I don't know how to use it or there is something wrong. Are you supposed to put spaces before and after the brackets {} or is the button supposed to space it for you?

Author Team
#3 | Posted: 16 Nov 2005 04:46 | Edited by: Team 
the code you're pasting should look as follows:
function a($ar){
foreach($ar as $k=>$v){
return $b;

This is just an example of course :)

You can also check a few more, already posted examples of [script]...[/script] and [pre]...[/pre] in this thread

So the example above will be auto-tabbed..

PS But if you have already tabbed/spaced text or script you can use the [pre]...[/pre] BBCode presented here.

Author lime
#4 | Posted: 16 Nov 2005 20:46 
Oh I get it now, I did it without even the line breaks at the test forum I guess that's why it didn't work. Thanks for the clarification.

Author Team
#5 | Posted: 6 Dec 2005 20:49 
Just to let everybody know, the solution has been updated. Some fixes regarding server compatibility have been added.

Author Guest
#6 | Posted: 29 Sep 2008 04:26 
is there any fix for this script tab?
when users put a long link or text in it, it becomes like this: solution with long text

Author Paul
Lead Developer
#7 | Posted: 29 Sep 2008 09:31 | Edited by: Paul 
it becomes like this

- and so what?..

Author Guest
#8 | Posted: 29 Sep 2008 16:48 
don't want like that cus it's change the forum design from normal and make it big !
for example if you write a long text in forum it's automaticly if too long coming like paragragh!
but in Script tab it's not ! and changing the forum making it big! with long text.

Author Paul
Lead Developer
#9 | Posted: 30 Sep 2008 03:00 | Edited by: Paul 
Naturally with the long text it will make it big, because it uses <pre></pre> HTML code which is not split by HTML rules.

I don't understand why do you need this solution at all, if it will be used just for marking some text in different color/background. In the recent miniBB version, we have introduced a special (still hidden) [ hl ][ /hl ] code, which stands for "highlight". It should split large phrases automatically.

For example:

this_is_a_very_large_sentense_note_the_place_where_it_splits_this_is_a_very_large_sentense_note_the_place_where_it_split s_this_is_a_very_large_sentense_note_the_place_where_it_splits_this_is_a_very_large_sentense_note_the_place_where_it_spl its_this_is_a_very_large_sentense_note_the_place_where_it_splits_this_is_a_very_large_sentense_note_the_place_where_it_s plits_this_is_a_very_large_sentense_note_the_place_where_it_splits_this_is_a_very_large_sentense_note_the_place_where_it _splits_this_is_a_very_large_sentense_note_the_place_where_it_splits_this_is_a_very_large_sentense_note_the_place_where_ it_splits...

Author Guest
#10 | Posted: 1 Oct 2008 05:53 
I don't understand why do you need this solution at all

you are right!
but I need this solution [code] [/code] for some important links, then just available for registred users!
so I thought script tab solution will solve my problem but not!
how can i get [code][/code] solution then just view by registered users!

Author Paul
Lead Developer
#11 | Posted: 1 Oct 2008 06:19 
You need to modify bb_codes.php file making a condition if($user_id>0) regarding this code.

Then by the same condition you can create a BB button, following the same logics as for [b] code for example (under main_post_form.html), and the make the button visible on the page similarly by the solution described here.

P.S. Don't ask for an exact code... it's your custom task, we won't provide it for free.

News & Announcements miniBB Support Forums / News & Announcements / Solution added: Automatic script tabbing ([script]...[/script] BBCode) Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB