FCKeditor: Delete emtpy paragraph

Delete/replace all empty paragraph created by the FCKeditor e.g. <p>&nbsp;</p>.

“FCKeditor creates emtpy paragraph 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 of your article header…. there are mostly empty paragraphs.” :-(

If you have such and are not willing to touch all content, place a small script in frontend_render.



rt_fck_del_emtpy_paragraph V1.0 11.09.09

Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=1&t=17401&p=119717#p119717

Autor: Oliver Georgi http://phpwcms.de
Autor: Ralph Häring (Santscho) http://www.yaml.phpwcms.org
CMS Version: >= 1.3.x
Version: V1.0

Tag: –

Filename: rt_fck_del_emtpy_paragraph.php

Folder: template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



rt_fck_del_emtpy_paragraph

<?php
/* ================================================================
11.09.2008  Oliver Georgi / Ralph Häring (Santscho)
Delete/replace all empty  paragraph created by the FCKeditor
 
Filename: rt_fck_del_emtpy_paragraph.php
Folder:   /template/inc_script/frontend_render/
Switch:   $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)
 
Forum:   http://forum.phpwcms.org/viewtopic.php?f=1&t=17401&p=119717#p119717
   ================================================================ */
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------
 
// 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']);
 
?>
english/phpwcms_replacer_rts/frontend_render/fck-delete-empty-parargraph.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0