How to remove line break <br /> after quote box </quote>

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Suggested Hosts
aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Mon May 12, 2014 8:37 pm

pit-PL wrote:Maybe you and your users didn't notice yet but there is the "Preview" button next to "Submit".
Yes but it is a totally unnecessary and avoidable expectation of users, due to a faulty design in phpbb's functionality. Why do you want the users to preview, account for and compensate for a useless additional line of space added by the forum software after the quote? I don't know any other forum software which has such expectation of its users.

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Mon May 12, 2014 8:42 pm

pit-PL wrote:Maybe you and your users didn't notice yet but there is the "Preview" button next to "Submit".
You would prefer the users to do the hard work when making each post and correct the spacing issues themselves, rather than fixing the forum software where the inconsistency is so that it will actually display what is typed in?

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Tue May 13, 2014 9:43 pm

Do these codes have anything to do with it?

In includes/message_parser.php :

Code: Select all

function prepare_bbcodes()
	{
		// Ok, seems like users instead want the no-parsing of urls, smilies, etc. after and before and within quote tags being tagged as "not a bug".
		// Fine by me ;) Will ease our live... but do not come back and cry at us, we won't hear you.

		/* Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.)
		if (strpos($this->message, '[quote') !== false && strpos($this->message, '[/quote]') !== false)
		{
			$this->message = str_replace("\r\n", "\n", $this->message);

			// We strip newlines and spaces after and before quotes in quotes (trimming) and then add exactly one newline
			$this->message = preg_replace('#\[quote(=".*?")?\]\s*(.*?)\s*\[/quote\]#siu', '[quote\1]' . "\n" . '\2' ."\n[/quote]", $this->message);
		}
		*/

		// Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...)
	}

OR...


In includes/bbcode.php :

Code: Select all

while ($row = $db->sql_fetchrow($result))
			{
				// To circumvent replacing newlines with <br /> for the generated html,
				// we use carriage returns here. They are later changed back to newlines
				$row['bbcode_tpl'] = str_replace("\n", "\r", $row['bbcode_tpl']);
				$row['second_pass_replace'] = str_replace("\n", "\r", $row['second_pass_replace']);

				$rowset[$row['bbcode_id']] = $row;
			}
			$db->sql_freeresult($result);

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Wed May 14, 2014 1:02 am

Anyone know the answer?

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Wed May 14, 2014 9:04 am

Brf wrote:PhpBB replaces line-breaks with <br />

Here in includes/functions_content.php:

Code: Select all

function bbcode_nl2br($text)
{
	// custom BBCodes might contain carriage returns so they
	// are not converted into <br /> so now revert that
	$text = str_replace(array("\n", "\r"), array('<br />', "\n"), $text);
	return $text;
}
Having played around with that code, it seems that this is where the problem needs to be fixed. Removing that entire piece of code removes the line gaps completely after the quote, and none of the carriage returns display as <br />. Anyone know how to modify this code so that only the first carriage return after the </quote> is not parsed into <br /> ? Then the line gap / spacing should display correctly.
Last edited by aqua_blue on Fri May 30, 2014 9:18 pm, edited 1 time in total.

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Thu May 29, 2014 3:23 am

It is disappointing to see that nobody was able to assist with this.

However, I have solved it myself. The quote box <div> should be displayed as 'inline-block' in order to prevent an extra <br /> being inserted after it. A width of 98% is also required. Hence, the following need to be added to <div> class 'quotecontent':

Code: Select all

display: inline-block;
width: 98%;
I hope the phpBB devs make note of this and correct it in upcoming releases.

User avatar
pit-PL
Registered User
Posts: 3085
Joined: Sat Nov 21, 2009 12:24 pm

Re: How to remove line break <br /> after quote box </quote>

Post by pit-PL » Fri May 30, 2014 8:21 pm

aqua_blue wrote:I hope the phpBB devs make note of this and correct it in upcoming releases.
I wouldn't hold my breath on that.
This is the intended behavior for obvious reasons, so it won't be changed.

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Fri May 30, 2014 8:26 pm

pit-PL wrote:
aqua_blue wrote:I hope the phpBB devs make note of this and correct it in upcoming releases.
I wouldn't hold my breath on that.
This is the intended behavior for obvious reasons, so it won't be changed.
What is the obvious reason? Are you saying that all the other forum software have got it wrong and you have got it right?

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Fri May 30, 2014 8:28 pm

PS. If you don't work for phpBB, I wouldn't speak for them.

aqua_blue
Registered User
Posts: 43
Joined: Mon May 12, 2014 10:25 am

Re: How to remove line break <br /> after quote box </quote>

Post by aqua_blue » Fri May 30, 2014 8:31 pm

Also, you obviously didn't understand the fix I provided. The 'intended behaviour' you are referring to hasn't been touched. The php files have not been changed at all. The required fix is totally a style issue relating to a missing CSS property.

User avatar
SwordCoastPL
Registered User
Posts: 5
Joined: Tue Sep 29, 2015 10:23 pm
Contact:

Re: How to remove line break <br /> after quote box </quote>

Post by SwordCoastPL » Fri Nov 20, 2015 11:19 pm

Sorry for double post, some lag! Please remove one!
AmigoJack wrote:Open /includes/message_parser.php and find:

Code: Select all

            'quote'            => array('bbcode_id' => 0,    'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")), 
Replace with:

Code: Select all

            'quote'            => array('bbcode_id' => 0,    'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#ise' => "\$this->bbcode_quote('\$0')")), 
This will only affect new posts (but has the advantage to not modify every post upon display again).
Hello. Sorry for digging up old post, but I need it.
Overall, great, found a way here and forums and it works! Strips all the blank lines. But only for last quote in the post for some reason.

The code in PhPBB3.1 is:

Code: Select all

			'quote'			=> array('bbcode_id' => 0,	'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#uise' => "\$this->bbcode_quote('\$0')")),
And I edited it to:

Code: Select all

			'quote'			=> array('bbcode_id' => 0,	'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#uise' => "\$this->bbcode_quote('\$0')")),
How to make it work for every quote in post?
Last edited by SwordCoastPL on Fri Nov 20, 2015 11:20 pm, edited 1 time in total.
Polski Portal Sword Coast Legends: www.swordcoast.pl
Polskie Forum Sword Coast Legends: forum.swordcoast.pl
Facebook: https://www.facebook.com/SwordCoastPL
Twitter: https://twitter.com/SwordCoastPL

You must gather your party before venturing forth.

User avatar
SwordCoastPL
Registered User
Posts: 5
Joined: Tue Sep 29, 2015 10:23 pm
Contact:

Re: How to remove line break <br /> after quote box </quote>

Post by SwordCoastPL » Fri Nov 20, 2015 11:19 pm

Sorry for double post, some lag! Please remove one!
AmigoJack wrote:Open /includes/message_parser.php and find:

Code: Select all

            'quote'            => array('bbcode_id' => 0,    'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")),
Replace with:

Code: Select all

            'quote'            => array('bbcode_id' => 0,    'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#ise' => "\$this->bbcode_quote('\$0')")),
This will only affect new posts (but has the advantage to not modify every post upon display again).
Hello. Sorry for digging up old post, but I need it.
Overall, great, found a way here and forums and it works! Strips all the blank lines. But only for last quote in the post for some reason.

The code in PhPBB3.1 is:

Code: Select all

			'quote'			=> array('bbcode_id' => 0,	'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#uise' => "\$this->bbcode_quote('\$0')")),
And I edited it to:

Code: Select all

			'quote'			=> array('bbcode_id' => 0,	'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\][\n\r\x0C]*#uise' => "\$this->bbcode_quote('\$0')")),
How to make it work for every quote in post?
Polski Portal Sword Coast Legends: www.swordcoast.pl
Polskie Forum Sword Coast Legends: forum.swordcoast.pl
Facebook: https://www.facebook.com/SwordCoastPL
Twitter: https://twitter.com/SwordCoastPL

You must gather your party before venturing forth.

mike2003
Registered User
Posts: 90
Joined: Sun Mar 20, 2016 12:10 am

Re: How to remove line break <br /> after quote box </quote>

Post by mike2003 » Mon May 09, 2016 12:12 am

aqua_blue wrote:It is disappointing to see that nobody was able to assist with this.
However, I have solved it myself. The quote box <div> should be displayed as 'inline-block' in order to prevent an extra <br /> being inserted after it. A width of 98% is also required. Hence, the following need to be added to <div> class 'quotecontent':

Code: Select all

display: inline-block;
width: 98%;
I hope the phpBB devs make note of this and correct it in upcoming releases.
Thank you very much. It is very strange that PHPBB makes so much empty space on the screen after each block (code/quote/lists/attach etc). This is bad and needs to be fixed :!: :!: :!:

Locked

Return to “[3.0.x] Styles Support & Discussion”