Magento Forum

   
Need help understanding Magento better
 
zorancho
Jr. Member
 
Total Posts:  9
Joined:  2009-12-23
 

Ok, as far as i understood, the layouts are loaded accordingly to the app/etc/modules/Mage_All.xml file… If there is layout from the loaded module with <reference name="left"> it will replace the left block set in page.xml (whis is the default layout)… or? What if i write my own module with my own layout, will my layout replace the default blocks if i use <reference name="name_of_the_block">?
I also see that <reference name="content"> is what you add from your CMS Manage Pages admin menu, is there a way to override that? To keep it as default backup content and try to override it with my own content from the module i am creating?
Thank you in advance!
Zoran

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shahid Sarvani
Member
 
Avatar
Total Posts:  63
Joined:  2009-08-05
 

Hi,

Let suppose in your module layout file you can write the code as follows to override the left and content block:

<yourmoldule_view_index>
        <
reference name="content">
            <
block type="yourmodule/yourblockclass" name="yourblockclass" template="yourmodule/index.phtml" />
        </
reference>
        <
reference name="left">
            <
block type="yourmodule/yourblockclass" name="yourblockclass" template="yourmodule/left.phtml" />
        </
reference>
</
yourmoldule_view_index>

let me have opportunity to explain the above code:

Let suppose that your website url is like that:

http://www.example.com/yourmodule/view/index

the above url will triger the above code and you will have your left and content section.

Let me know in case of any issue and more help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zorancho
Jr. Member
 
Total Posts:  9
Joined:  2009-12-23
 

OK, thanks for your response, i think i have more than basic idea of how layout works… but what about helpers and blocks classes, could i use models from every module?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top