FCKeditor creates emtpy paragraph

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
beat
Posts: 99
Joined: Wed 23. Nov 2005, 15:18
Location: Gerzensee
Contact:

FCKeditor creates emtpy paragraph

Post by beat »

Hi All

I have a problem with FCKeditor I need to solve soon. In PHPWCMS 1.3.9 FCKeditor creates in each empty Field a empty paragraph. I've disabled it with

Code: Select all

FCKConfig.FillEmptyBlocks	= false ;
but FCKeditor is anyway placing a <p>&160;</p>.

This is absolutley not user Friendly. Is there any solution to this problem?

Thanks for your help.
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Re: FCKeditor creates emtpy paragraph

Post by pepe »

Die Einstellung war ja schon mal richtig!

Lösche mal den Cache und starte doch mal deine Anwendung komplett neu...

Ein neuer Aufruf des Editors alleine reicht nicht aus!
Und versuch damm mal einen neuen CP... dann klappt das auch!
User avatar
santscho
Posts: 1442
Joined: Mon 2. Apr 2007, 08:56
Location: Schweiz

Re: FCKeditor creates emtpy paragraph

Post by santscho »

And you have to open all articles/CPs which are allready done. then you have to switch into the html mode of your fckeditor and delete the unwanted paragraph. Save the CP/Article and the problem should be solved. PHPWCMS will not remove the empty paragraphs for you.

Special in the Summary field ouf your article header.... there are mostly empty paragraphs :-(
Schon Konfuzius sagte: "Sei kein YAML-Lappen". YAML-phpwcms-Integration auf http://www.yaml.phpwcms.org
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: FCKeditor creates emtpy paragraph

Post by Oliver Georgi »

If you have such and are not willing to touch all content place a small script in frontend_render, maybe name it replace_all.php:

Code: Select all

<?php
// Search and replace
$_search = array(	 '<br>',
							'<p>&nbsp;</p>', 
							'<p><p>', 
							'</p></p>', 
							'...', 
							' - ', 
							"<br />\r\n&nbsp;</p>",
							'<p><br />',
							'<p>&160;</p>'
							);
$_replace = array(	'<br />',
							'', 
							'<p>', 
							'</p>', 
							'&#8230;', 
							' &#8211; ', 
							'</p>',
							'<p>',
							''								
							);

$content['all'] = str_replace($_search, $_replace, $content['all']);
?>
And

Code: Select all

FCKConfig.FillEmptyBlocks = false;
is the default setting since some revisions.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
santscho
Posts: 1442
Joined: Mon 2. Apr 2007, 08:56
Location: Schweiz

Re: FCKeditor creates emtpy paragraph

Post by santscho »

Here an extension of Oliver's script above.

In case the empty paragraph is placed in a div container which has a border or is filled with color/background image, the script will only remove <p>&nbsp;</p>. An empty div will remain with all its props. Means, you will get an unwanted line or color bar even you don't want it. Therefore, you have to advise the script to remove the whole div container.

In my example, I remove the article summary with an empty paragraph.

Code: Select all

<?php
// Search and replace
$_search = array(    '<br>',
                     '<p>&nbsp;</p>',
                     '<div class="article_summary"><p>&#160;</p></div>',
                     '<p><p>', 
                     '</p></p>', 
                     '...', 
                     ' - ', 
                     "<br />\r\n&nbsp;</p>",
                     '<p><br />',
                     '<p>&160;</p>'
                     );
$_replace = array(   '<br />',
                     '', 
                     '', 
                     '<p>', 
                     '</p>', 
                     '&#8230;', 
                     ' &#8211; ', 
                     '</p>',
                     '<p>',
                     ''                        
                     );

$content['all'] = str_replace($_search, $_replace, $content['all']);
?>
In case you want to remove the graphical elements of a div container, but not its padding (eg. to keep the distance between subtitle and Content Parts), you can replace the unwanted div with an other div.

So I duplicate the css class ".article_summary" in my .css, remove all the graphical attributes (borders, fillings) and keep only the padding, rename the class (eg. ".article_summary_empty") and advice phpwcms to replace:

Code: Select all

<?php
// Search and replace
$_search = array(    '<br>',
                     '<p>&nbsp;</p>',
                     '<div class="article_summary"><p>&#160;</p></div>',
                     '<p><p>', 
                     '</p></p>', 
                     '...', 
                     ' - ', 
                     "<br />\r\n&nbsp;</p>",
                     '<p><br />',
                     '<p>&160;</p>'
                     );
$_replace = array(   '<br />',
                     '', 
                     '<div class="article_summary_empty"></div>', 
                     '<p>', 
                     '</p>', 
                     '&#8230;', 
                     ' &#8211; ', 
                     '</p>',
                     '<p>',
                     ''                        
                     );

$content['all'] = str_replace($_search, $_replace, $content['all']);
?>
Schon Konfuzius sagte: "Sei kein YAML-Lappen". YAML-phpwcms-Integration auf http://www.yaml.phpwcms.org
Post Reply