Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Putting content in a centralk content area
 
Urbanite
Jr. Member
 
Total Posts:  4
Joined:  2008-11-01
 

I have setup a template for a site with an div named “main-content”.  I am trying to push the Magento native stuff into that area.

Taking the standard login screen as an example:

<customer_account_login>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>

<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
</reference>
</customer_account_login>

I have the root node pointed to my template, and that works well. How do I get the login.phtml to show in my “Main-Content” div?

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

It sounds like you’re thinking of it backwards.
Your template file contains the div.  Your template file is a phtml file.
So you don’t get a phtml file to show in your div.
You put your div in a template file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Urbanite
Jr. Member
 
Total Posts:  4
Joined:  2008-11-01
 

Thanks for the reply, but that is not the case. I am trying to understand how Magento understands where to put content in a given layout. Generally, this all comes together with the XML file referencing the phtml.

My question is about the details on that relationship. In particular, how does Magento know to put the “login.phtml” into a certain area on the site? And can that be changed?

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 
Urbanite - 03 November 2008 03:54 AM

Thanks for the reply, but that is not the case. I am trying to understand how Magento understands where to put content in a given layout. Generally, this all comes together with the XML file referencing the phtml.

You just said it.
The phtml file says exactly how to output it, so you can make a lot of changes there without touching the XML. And the CSS lets you move things around as well.

For most of my changes, I have not had to change XML. Mostly my changes to the XML involved commenting out things I don’t want to appear (which can also be done in the template). And I just found out today (although I don’t quite understand it yet), that you can change the XML in the Design section in the backend, which will override the XML in the files.

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