Magento – How to Edit HTML Content Template

templatetheme

Here's an example with the About page:

<div class="col-main">
  <div class="std">
    //First line of content entered into UI content editor

When looking inside my 2columns-right.phtml:

<div class="col-main">
  <?php echo $this->getChildHtml('content') ?>

So this tells me this <div class="std"> is somewhere in some template. I've tried grepping my entire Magento directory and find only references under product/view.phtml, list.phtml, and description.phtml. None of these are used for the CMS pages and so I'm at a loss for where I can find these content templates.

The end goal is finding where I can edit the templates to remove unwanted elements like this.

Best Answer

The answer is in this bit of XML inside of base/default/layout/cms.xml:

<cms_page translate="label">
    ...
    <reference name="content">
        ...
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            ...
            <action method="setElementClass"><value>std</value></action>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

The wrapper block adds a <div> you are looking for and setElementClass method sets the std class on it.

UPDATE

To remove the wrapper "correct" way within local.xml file of your custom theme you have to move cms_page block directly to content block using unsetChild/remove routine and then removecms.wrapper` block.

Related Topic