Skip to content

Instantly share code, notes, and snippets.

@bavington
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bavington/76c8fe4334c9270f3238 to your computer and use it in GitHub Desktop.
Save bavington/76c8fe4334c9270f3238 to your computer and use it in GitHub Desktop.
Magento Layout XML Snippets
<!-- Adding JS or CSS -->
<reference name="head">
<!-- Using add Method -->
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<!-- Using addItem Method -->
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
</reference>
<!-- Adding External JS or CSS to your Theme -->
<reference name="head">
<block type="core/text" name="jquery">
<action method="setText"><text><![CDATA[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>]]></text></action>
</block>
<block type="core/text" name="mybuyscsscode">
<action method="setText"><text><![CDATA[<link href="//t.p.mybuys.com/css/mbstyles.css" rel="stylesheet" type="text/css" id="mybuysstyles">]]></text></action>
</block>
</reference>
<!-- Setting the Robots Meta Tag per page (Via CMS) -->
<reference name="head">
<action method="setRobots"><value>NOINDEX,FOLLOW</value></action>
</reference>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment