Forums

how to remove p tags from CMENUBODY


Jimako ยป 2 years ago

Actual situation: all bbarea fields have now
<p></p>
tags around text (you can manually change it to
<div> </div>,
but reductact tags are still there)

Why is it problem?

If your markup is for example (problems with W3C validation):

<h3>{CMENUBODY} </h3> - Error: Element p not allowed as child of element h3 in this context.

OR
<p class="featured-desc">{CMENUBODY}</p> - Error: No p element in scope but a p end tag seen.

So what to do? Override core CMENUBODY shortcode in theme shortcodes.

  1. add add theme_shortcodes class $override variable (before _construct() )

var $override = true;

  1. add new method:
function sc_cmenubody($parm='')
{
    $sc   = e107::getScBatch('page', null, 'cpage');
    $data = $sc->getVars();                
    $text =  e107::getParser()->toHTML(vartrue($data['menu_text'],''), true, 'BODY');  
    $text =  str_replace(array("<!-- bbcode-html-start --><p>","</p><!-- bbcode-html-end -->"), "", $text);
    return $text; 
}	

It's done. Just remember that all CMENUBODY is now without
<p></p>
tags, so you need to use
<p>{CMENUBODY}</p>
anywhere in template


JMadmin

Jimako
Main Admin
JMadmin

Moderator(s): Jimako

Latest Downloads

JM Download plugin 1.2
in Category: JM Download plugin

JM Download plugin 1.2

3 weeks ago

Plugin for extending the core Download plugin. Version 1.3 on Github Replaced JM_Download plugin, Latest Releases by Father Barry,  Top Downloads menu by SecretR, AACGC Download Tracker by M@CH!N3 V 
Read more..

JM Download plugin 1.2
JM Core plugin 1.6.0
in Category: e107 plugins

JM Core plugin 1.6.0

1 month ago

The version used on this site. It fixes some core limitation via the plugin, no core changes. Check Readme at first.  Version 1.6.1 on github What is inside? - fix for missing titles in the m 
Read more..

JM Core plugin 1.6.0
ReCaptcha plugin 1.3
in Category: ReCaptcha plugin

ReCaptcha plugin 1.3

1 month ago

No CAPTCHA reCAPTCHA Captcha replacement for e107 v2.2 or higher with shortcodes.  Added shortcodes for replacing contact secure image shortcodes. Possibility to hide it from logged users.
Read more..

ReCaptcha plugin 1.3