First approach: page.xml - you can add something like
<action method="addJs"><script>path/to/my/file.js</script></action>
Second approach: Find page/html/head.phtml
in your theme and add the code directly to page.html
.
Third approach: If you look at the stock page.html mentioned above, you'll see this line
<?php echo $this->getChildHtml() ?>
Normally, the getChildHtml method is used to render a specific child block. However, if called with no paramater, getChildHtml will automatically render all the child blocks. That means you can add something like
<!-- existing line --> <block type="page/html_head" name="head" as="head">
<!-- new sub-block you're adding --> <block type="core/template" name="mytemplate" as="mytemplate" template="page/mytemplate.phtml"/>
...
to page.xml
, and then add the mytemplate.phtml
file. Any block added to the head block will be automatically rendered. (this automatic rendering doesn't apply for all layout blocks, only for blocks where getChildHtml is called without paramaters).
<catalog_category_default>
<remove name="right"/>
<remove name="left"/>
</catalog_category_default>
<default>
<remove name="right"/>
<remove name="left"/>
</default>
<default>
<reference name="head">
<action method="addCss"><css>css/override.css</css></action>
<action method="addItem">
<type>skin_js</type>
<name>js/jquery-1.7.2.min.js</name>
</action>
</reference>
</default>
<cms_index_index>
<reference name="head">
<action method="addCss">
<stylesheet>your path/your css file name</stylesheet>
</action>
<action method="addItem">
<type>skin_js</type>
<name>js/jquery-1.7.2.min.js</name>
</action>
</reference>
</cms_index_index>
<reference name="head">
<action name="addItem"><type>skin_css</type>
<name>css/my_style.css</name>
</action>
<action method="addItem"><type>skin_js</type>
<name>js/jquery-1.7.2.min.js</name>
</action>
</reference>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>My Link</label>
<url helper="customer/getAccountUrl"/>
<title>My Link</title><prepare/>
<urlParams/><position>11</position></action>
</reference>
Adding a Footer Link
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog">
<label>My Link</label><url helper="catalog/map/getCategoryUrl"/>
<title>My Link</title><position>0</position>
</action>
</reference>
<reference name="top.links">
<action method="setTemplate">
<template>page/template/mylinks.phtml</template>
</action>
</reference>
<remove name="left.newsletter" />
<remove name="left.permanent.callout" />
<remove name="catalog.compare.sidebar" />
<remove name="right.permanent.callout" />
<remove name="cart_sidebar" />
<remove name="paypal.partner.right.logo" />
<remove name="right.poll" />
<reference name="footer">
<block type="newsletter/subscribe" name="newsletter" as="newsletter_subscribe"
template="newsletter/subscribe.phtml" before="-" />
</reference>
</default>
<customer_account_index>
<reference name="left">
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</reference>
</customer_account_index>
<cms_index_index>
<remove name="right.poll" />
<reference name="left">
<block type="core/template" name="custom_index" template="custom/index.phtml"/>
</reference>
<reference name="content">
<block type="core/template" name="custom_index" template="custom/index.phtml"/>
</reference>
<reference name="header"> <!-- Call with getChildHtml() in header.phtml-->
<block type="core/template" name="custom_block"
template="custom/customblock.phtml"/>
</reference>
<reference name="footer"> <!-- Call with getChildHtml() in footer.phtml-->
<block type="core/template" name="custom_block"
template="custom/customblock.phtml"/>
</reference>
</cms_index_index>
<helloworld_index_index translate="label">
<update handle="customer_logged_in" />
</helloworld_index_index>
<catalog_category_default translate="label">
<reference name='product_list'>
<action method='setTemplate'>
<template>catalog/product/mylist.phtml</template>
</action>
</reference>
</catalog_category_default>