Too much <br /> Tags in frontend output

Found a bug? Tell us!!
Post Reply
ManuelK
Posts: 2
Joined: Sun Dec 08, 2013 9:06 pm

Too much <br /> Tags in frontend output

Post by ManuelK »

Hello,

After installing and trying Serendipity now for a few days, I recognized a strange behaviour on my site.

Step 1:
Opening the frontend index site delivers i. e. following html code (page -> view source in firefox and chrome) in the article:

Code: Select all

<div class="entry-content serendipity_entry_body">
                <p> <br />
<table cellspacing="1" cellpadding="1" border="0" style="width: 100%;"> <br />
<tbody> <br />
<tr> <br />
<td style="width: 50%;"><img width="320" height="240" src="/uploads/Backen/Weihnachten/Marzipan-Nougat-Pltzchen.jpg" class="serendipity_image_left" /></td> <br />
<td style="width: 50%;"> <br />
<p>&nbsp;Teig:</p> <br />
<p>275 Mehl Typ 405<br />150 g Zucker<br />1 P. Vanillezucker<br />175 g weiche Butter<br />2 Eigelb</p> <br />
<p>Belag:</p> <br />
<p>300 g Marzipan-Rohmasse<br />3 Eiweiß</p> <br />
<p>Füllung:<br />200 g Nougat<br />30 Zartbitter-Kuvertüre<br /></p> <br />
<p>Garnitur:<br />gehackte Pistazien<br /></p> <br />
</td> <br />
</tr> <br />
</tbody> <br />
</table> <br />
</p> <br />
<p>Zubereitung:</p> <br />
<p>Mehl mit Zucker, Vanillezucker, Butter und Eigelb zu einem glatten Teig verkneten und für ca. 60 Min. in den Kühlschrank stellen.<br />Für den Belag das Marzipan in kleine Stücke schneiden und mit dem Eiweiß glatt rühren. Den Teig auf einer bemehlten Arbeitsfläche ca. 3 mm dick ausrollen. <br />Plätzchen ausstechen und diese auf mit Backpapier belegte Bleche legen. Mit einem Spritzbeutel (Sterntülle) die Marzipanmasse so auf die Plätzchen spritzen, dass die Mitte frei bleibt. Im vorgeheizten Backofen ca. 10-12 Min. Auskühlen lassen.</p> <br />
<p>Für die Füllung ca. 30 g Zartbitter-Kuvertüre auf einem warmen Wasserbad schmelzen, Nougat hinzufügen, schmelzen lassen und gut verrühren. In die Mitte der Plätzchen mit einem Spritzbeutel (Sterntülle) kleine Nougatrosetten spritzen, mit Pistazien bestreuen und vollständig trocknen lassen.<br /></p>
                           </div>
(Lookout for <br /> Tags on wrong places, i. e. after <tbody>)

Step 2:
Logging into Backend and open frontend again vie button "Back To Blog" the frontend index site delivers now following html code for previous example (page -> view source in firefox and chrome) in the article:

Code: Select all

<div class="entry-content serendipity_entry_body">
                <p> 
<table cellspacing="1" cellpadding="1" border="0" style="width: 100%;"> 
<tbody> 
<tr> 
<td style="width: 50%;"><img width="320" height="240" src="/uploads/Backen/Weihnachten/Marzipan-Nougat-Pltzchen.jpg" class="serendipity_image_left" /></td> 
<td style="width: 50%;"> 
<p>&nbsp;Teig:</p> 
<p>275 Mehl Typ 405<br />150 g Zucker<br />1 P. Vanillezucker<br />175 g weiche Butter<br />2 Eigelb</p> 
<p>Belag:</p> 
<p>300 g Marzipan-Rohmasse<br />3 Eiweiß</p> 
<p>Füllung:<br />200 g Nougat<br />30 Zartbitter-Kuvertüre<br /></p> 
<p>Garnitur:<br />gehackte Pistazien<br /></p> 
</td> 
</tr> 
</tbody> 
</table> 
</p> 
<p>Zubereitung:</p> 
<p>Mehl mit Zucker, Vanillezucker, Butter und Eigelb zu einem glatten Teig verkneten und für ca. 60 Min. in den Kühlschrank stellen.<br />Für den Belag das Marzipan in kleine Stücke schneiden und mit dem Eiweiß glatt rühren. Den Teig auf einer bemehlten Arbeitsfläche ca. 3 mm dick ausrollen. <br />Plätzchen ausstechen und diese auf mit Backpapier belegte Bleche legen. Mit einem Spritzbeutel (Sterntülle) die Marzipanmasse so auf die Plätzchen spritzen, dass die Mitte frei bleibt. Im vorgeheizten Backofen ca. 10-12 Min. Auskühlen lassen.</p> 
<p>Für die Füllung ca. 30 g Zartbitter-Kuvertüre auf einem warmen Wasserbad schmelzen, Nougat hinzufügen, schmelzen lassen und gut verrühren. In die Mitte der Plätzchen mit einem Spritzbeutel (Sterntülle) kleine Nougatrosetten spritzen, mit Pistazien bestreuen und vollständig trocknen lassen.<br /></p>
                           </div>
Now the <br /> Tags are gone.

Further information:
Site: http://kochen.i-dreams.de
Blog-Version: Serendipity 1.7.3
PHP-Version: PHP 5.3.10-1ubuntu3.8
Style: Bulletproof v1.4 (s9y-bulletproof.com)

user.css

Code: Select all

#serendipity_banner {
    margin: 0;
    height: 260px;
    background-color: #ffffff ;
    border: 0px;
    border-bottom: 1px dotted black;
}
Any suggestions/workarounds on this? I found nothing matching my problem searching this forum.


Kind regards

Manuel
ManuelK
Posts: 2
Joined: Sun Dec 08, 2013 9:06 pm

Re: Too much <br /> Tags in frontend output

Post by ManuelK »

Disabled nl2br plugin formatting on entry now it works as expected.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Too much <br /> Tags in frontend output

Post by Timbalu »

Hi

To disable NL2BR is not really an option, since it takes care about all entry-like core frontend output, eg comments, entries, nuggets. Good coders knowing these internals do not need to care and may disable the plugin at all, still in the need to install something else for comments. But for all the others, it is more or like a need.

Each linebreak via ENTER or by nice structured hand-written html code (like your table structure) enters the database as a \n linebreak, which needs html to read <br />. This simply is what nl2br does. For the matters of simplicity vs more advances text and entry content, the nl2br plugin has different options to deal with these situations. It has the NL2P option, which sets to use <p></p> instead, or uses ISOBR, to stick with the br, but enables the writer to exclude certain entry parts by NO-BR blocks (<nl></nl>). I personally like sticking with ISOBR, which better deals with all kind of complicated structures. (*)

This all is about the PLAIN "Editor" for entries only. If using a WYSIWYG-Editor, this is not an issue for entries.

http://board.s9y.org/viewtopic.php?f=10 ... #p10432048

(*) There also is the entryproperties plugin, which enables you to disable the use of nl2br plugin (and some others) for a certain written entry on submit. So - in short - there are various ways to deal with these situations.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Too much <br /> Tags in frontend output

Post by garvinhicking »

Hi!

You probably want to disable nl2br only for blog entries, not for comments. You can do that in the configuration of that plugin.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply