Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change magento's cms content wrapper

Tags:

magento-1.7

I am using magento 1.7. i have tried to change wrapper of cms content but still i cannot get how i can change wrapper of cms_page.

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

and html output is

<div class="std">
    CMS Page content
</div>

but i want to output like this

<section class="std">
    CMS Page Content
</section>

Please give me any solution

like image 271
Pooja Bohra Avatar asked Feb 17 '23 23:02

Pooja Bohra


1 Answers

You can try following code for change div to section

<block type="page/html_wrapper" name="cms.wrapper" translate="label">
    <label>CMS Content Wrapper</label>
    <action method="setElementClass"><value>std</value></action>
    <action method="setAttribute"><param1>html_tag_name</param1><param2>section</param2></action>
    <block type="cms/page" name="cms_page"/>
</block>

this will change div to section because html_wrapper class get tag name from a function getElementTagName in app\code\core\Mage\Core\Block\Abstract\Wrapper.php

/**
 * Wrapper element tag name getter
 * @return string
 */
public function getElementTagName()
{
    $tagName = $this->_getData('html_tag_name');
    return $tagName ? $tagName : 'div';
}

so by calling setAttribute we change/set value of html_tag_name

like image 189
Aryan Negi Avatar answered Apr 26 '23 22:04

Aryan Negi