Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Line breaks gets removed (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 1
TOPIC: Re:Line breaks gets removed
#319
4u2 (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Line breaks gets removed 3 Years, 3 Months ago Karma: 0  
I try to use <br /> inside the module, but once I save the content, it erases the code
<br />
and instead changes the look of the code to include a line break. The output of the code has no effect. So right now to be able to have line breaks, I have to include every segment in a
<p>
, but then the spaces between the lines are too big. Is there a way to get around this? Thanks.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#320
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Line breaks gets removed 3 Years, 3 Months ago Karma: 10  
Hi,

Unfortunately the removal of <br /> is needed. Joomla automatically converts new lines (\n) into <br /> tags. So you cannot tell if the <br /> is added by Joomla (which would corrupt PHP code, and xHTML which uses block level elements for layout) or intended.

So all <br /> is removed.

The other option with mod PHP would be to parse the PHP code - either with the tokenizer or regular expressions, and decide which <br /> is intended and which isn't, which would be unnecessary overhead 99% of the time. It still doesn't solve the unintended <br /> tags in xHTML however.

The other option is to style your <p> tags with CSS. Add the styling you need.

eg:

<div class="my_custom_content">

<p>Some text</p>
<p>Some text</p>

</div>
and in CSS
div.my_custom_content p {
  margin:0;
  padding:5px 2px;
}
Notice I'm using the CSS selector: div.my_custom_content p instead of just p So we do not select all the other <p> tags in the document. Just that inside the div
<div class="my_custom_content">
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1154
hal (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Line breaks gets removed 2 Years, 1 Month ago Karma: 0  
This is an annoying bug - has anyone reported it to the Joomla developers?

The workaround I use for this issue is to use the following code instead of the <br /> tag:
<? echo '<br'.' />'; ?>
Admittedly it is quite verbose, but at least the formatting of the code in the module parameter is not modified every time the module is saved. If anyone has a better idea, then please suggest it! Cheers Hal
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1156
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Line breaks gets removed 2 Years, 1 Month ago Karma: 10  
Great workaround! Thanks for sharing.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.