<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Magento Coder &#187; Frontend</title>
	<atom:link href="http://magentocoder.jigneshpatel.co.in/category/html/frontend/feed/" rel="self" type="application/rss+xml" />
	<link>http://magentocoder.jigneshpatel.co.in</link>
	<description>hacks &#38; solutions for Magento Ecommerce development</description>
	<lastBuildDate>Sun, 19 Jun 2011 16:13:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>How to add a new body class to Magento layout</title>
		<link>http://magentocoder.jigneshpatel.co.in/how-to-add-a-new-body-class-to-magento-layout/</link>
		<comments>http://magentocoder.jigneshpatel.co.in/how-to-add-a-new-body-class-to-magento-layout/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 13:28:02 +0000</pubDate>
		<dc:creator>Jignesh</dc:creator>
				<category><![CDATA[Frontend]]></category>

		<guid isPermaLink="false">http://magentocoder.jigneshpatel.co.in/?p=89</guid>
		<description><![CDATA[Adding a CSS body class to Magento layouts seems very easy. In case you want different CSS body class for different module pages on frontend, what you need to do is to find the syntax: $this->loadLayout(); in module controller files and add some new lines just below it. Example: I want to set the &#8216;my-profile&#8217; class to all the customer pages on frontend. So I opened the AccountController.php &#038; edited the function indexAction(). Just below [...]]]></description>
			<content:encoded><![CDATA[<p>Adding a CSS body class to Magento layouts seems very easy.</p>
<p>In case you want different CSS body class for different module pages on frontend, what you need to do is to find the syntax: $this->loadLayout(); in module controller files and add some new lines just below it. </p>
<p>Example:<br />
I want to set the &#8216;my-profile&#8217; class to all the customer pages on frontend. So I opened the AccountController.php &#038; edited the function indexAction(). Just below the &#8216;$this->loadLayout();&#8217; I added few lines. So it will look as below.</p>
<pre class="brush: php; title: ;">
        $this-&gt;loadLayout();

	    if ($root = $this-&gt;getLayout()-&gt;getBlock('root')) {
	            $root-&gt;addBodyClass('my-profile');
	    }
</pre>
<p>However above code needed to be altered in the core code. So better to follow the below.</p>
<p>To update it via layout XML, </p>
<pre class="brush:php">
<reference name="root">
 <action method="addBodyClass"><className>my-profile</className></action>
</reference>
</pre>
<p>This will affect in the &lt;body&gt; tag.</p>
<pre class="brush:php">
&lt;body &lt;?php echo $this->getBodyClass()?'class="'.$this->getBodyClass().'"':'' ?&gt;&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://magentocoder.jigneshpatel.co.in/how-to-add-a-new-body-class-to-magento-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

