how to remove p tags from CMENUBODY / Tip and tricks / Forums

  • Actual situation: all bbarea fields have now
    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.

    <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
    tags, so you need to use
    anywhere in template


Search just forum
You must be logged in to post comments on this site - please either log in from the Login box or from here.

  • Jimako
    Jimako  2 weeks ago

    @wrxxy I am ill, sorry cant log in gitter from mobile. Try ask at main room, nothing except update was changed.

  • Jimako
    Jimako  1 month ago

    @wrxxy I got notification from gitter but I am off until Monday. I am not able to log in gitter. Answer is add it to existing gitjub issue.

  • Jimako
    Jimako  3 months ago

    I will be on holiday until end of November. So no answers from me until then.

  • Jimako
    Jimako  3 months ago

    After 2 days I was able to create demo of BS Magazine 01 theme:

  • Jimako
    Jimako  3 months ago

    My antivirus software blocked and disabled gitter.