Search This Blog

Mind freaker Stuff

Please Visit my new blog http://www.mindfreakerstuff.com for new articles related to web and mobile designing.

Friday, September 30, 2011

Editing the Footer in a stock magento build

The items in the footer area are in two different locations. One part is a static block created within the magento admin area (CMS > Static Block). The other part is held in the related .phtml / .php / .xml files within the design files.
First off, the XML files

app/design/frontend/*/*/layout/page.xml
Here you will find some footer reference:
<block type="page/html_footer" name="footer" as="footer" 
template="page/html/footer.phtml">
<block type="page/switch" name="store_switcher" 
as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" 
as="footer_links" template="page/template/links.phtml"/>
</block>
app/design/frontend/*/*/layout/cms.xml
<reference name="footer">
<block type="cms/block" name="cms_footer_links" before="footer_links">
<!--
The content of this block is taken from the database by its block_id.
You can manage it in admin CMS -> Static Blocks
-->
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</reference>
You can see that the footer area of each page (page.xml) adds footer links via:
app/design/frontend/*/*/template/page/html/footer.phtml
This file (footer.phtml) contains a method to get it’s children HTML as referenced in the page.xml file – ($this->getChildHtml();)
-app/design/frontend/*/*/template/page/switch.phtml
-app/design/frontend/*/*/template/page/template/links.phtml
footer.phtml is basically a “shell” which includes the “report bugs to magento” text. It also calls the getChildHtml method to get the rest in there.
One important part of the footer’s children HTML are the links:
The .phtml file , however, grabs links from the method “$this->getLinks()” found in the Block .php file controlling the template…. so the hunt begins.
The Block file controlling this template is:
app/code/core/mage/page/Template/Links.php
However, here you will find that this only has generic code for entering links! Where, then, are these links coming from? Well…a lot of places :(


<!--contacts.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" 
ifconfig="contacts/contacts/enabled"><label>Contact Us</label>
<url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
</reference>

<!--rss.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="rss" 
ifconfig="rss/config/active"><label>RSS</label><url>rss</url>
<title>RSS testing</title><prepare>true</prepare><urlParams/>
<position/><li/><a>class="link-feed"</a></action>
</reference>

<!--catalogsearch.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" 
module="catalogsearch" ifconfig="catalog/seo/search_terms">
<label>Search Terms
</label><url helper="catalogsearch/getSearchTermUrl" />
<title>Search Terms</title></action>
<action method="addLink" translate="label title" 
module="catalogsearch"><label>Advanced Search</label>
<url helper="catalogsearch/getAdvancedSearchUrl" /><
title>Advanced Search</title></action>
</reference>

<!--catalog.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog" 
ifconfig="catalog/seo/site_map"><label>Site Map</label>
<url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
</reference>


Now, as for the other links (About Us and Customer Service) they are 
merely created in the Admin section as mentioned. Admin > CMS > 
Static Blocks.

They are referenced in cms.xml as shown above. You can use this method to
 show static blocks creating in the CMS area of the admin section anywhere (the
 much-repeated emphasis on being able to use PHP code to do the job of 
the XML (or visa versa) is handy to add a static block somewhere in your
 code instead of using xml).
 
 
 
For More Details
 
ref - 


http://www.exploremagento.com/magento /editing-the-footer-in-a-stock-magento-build.php

1 comment: