News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How do I stop the BBCode parser from inserting <br>s?

Started by NanoSector, April 01, 2012, 07:25:02 AM

Previous topic - Next topic

NanoSector

Hi,

As the title says. Whenever I add one of my new tags into my posts, add an Enter to organize the BBCode (as it includes quite a few sub-elements which are also made by me), it adds a <br> which messes up the layout.

e.g.

[myelement]
[mysubelement]
Text
[/mysubelement]
[/myelement]


This gets a few <br>s and I want to stop it from doing so.

SMF version 2.0.2.
Using hooks to add the BBCodes.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Ricky.

Br is automatically added for each carriage return , here actually its hard to say anything without seeing what actually you are trying to achieve .
Though you may look into : 'block_level' => true, for your bbcode if you want it to give its own space !

emanuele

Take also a look at the 'trim' => 'inside/outside' option you can add to your bbc tag.

Not sure if it helps or not, just a hint. ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

NanoSector

#3
Thanks.

I'm trying to create a menu-bar-in-a-post system for the last mod I've submitted (FancyPosts).
Point is, if I organize the BBCode it messes up the buttons and places them somewhat underneath-beside each other.

I will try to add that, maybe it even helps with placing them in other elements :)

As a side-question, is it possible to have it check if a parameter is set to TRUE and then add something?

e.g.
[menu][button url=http://map3cms.co.cc/ active=true]Test[/button][/menu]

If the active parameter is TRUE, I'd like it to add the "active" CSS class into the HTML code.
Any way to achieve that with this code:
        $codes[] = array(
                        'tag' => 'button',
                        'type' => 'parsed_equals',
                        'before' => '<li><a href="$2" class="firstlevel"><span class="firstlevel">',
                        'after' => '</span></a></li>',
                        'trim' => 'outside',
                        'require_parents' => array('menu'),
                );


@emanuele: I'll take a look at that in a moment :)
EDIT: Didn't work, sorry.
EDIT2: Adding 'trim' => 'outside', did, heh. Thanks :)

Ricky.'s suggestion messed up even more :(
EDIT3: Nevermind, posted a new topic to keep stuff organized.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Ricky.

To check things, you can use create_function , like :

'validate' => create_function('&$tag, &$data,'Here youre checking stuff ')

NanoSector

#5
Quote from: Ricky. on April 01, 2012, 10:22:20 AM
To check things, you can use create_function , see already used bbcode there, many are using create_function to create on-fly function inside arrays to test things out and even validations.
Yeah, I already was thinking of using that. Let me try it in a second.

EDIT: Also works, yay.

Thanks for the help, Ricky.!
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

kenber

<Snipped by K@>

pixelgeek

Quote from: Ricky. on April 01, 2012, 07:54:08 AM
Br is automatically added for each carriage return , here actually its hard to say anything without seeing what actually you are trying to achieve .
Though you may look into : 'block_level' => true, for your bbcode if you want it to give its own space !

Sorry to necro this thread but I wanted to add an update for anyone who was having the same issue with BR tags.

This does indeed work but you need to make sure that you add the block_level attribute to any tags that are parents of the tag in question or your BBCode execution will break

Advertisement: