views:

38

answers:

1

Here’s what’s going on: I have a page content for a module rendering in my 3 column layout (which I believe is the default) and I want it to render in 1 column, but I don’t know how.

The longer version: I’m using Unirgy’s Dropship Microsite and I’m trying to get the vendor landing page to render in the 1 column layout. My layout xml file looks like this:

<?xml version="1.0"?>
<layout>
    <udropship_vendor_login>
        <reference name="login_links">
            <action method="addLink" translate="label title" module="umicrosite">
                <label>Register New Account</label>
                <url helper="umicrosite/getVendorRegisterUrl"/>
                <title>Register New Account</title><prepare/>
                <urlParams/>
                <position>20</position>
            </action>
        </reference>
    </udropship_vendor_login>

    <umicrosite_vendor_register>
        <update handle="udropship_vendor" />
        <reference name="content">
            <block type="directory/data" template="unirgy/microsite/vendor/register.phtml" name="register" />
        </reference>
    </umicrosite_vendor_register>

  [..removed unrelated xml..]

    <umicrosite_index_index>
        <reference name="content">
          <block type="core/template" template="unirgy/microsite/home.phtml" name="vendorHome" />
        </reference>
    </umicrosite_index_index>
</layout>

What’s interesting is that umicrosite_vendor_register renders in 1 column, but umicrosite_index_index renders in the default 3 column layout. I’ve tried changing its block type to directory/data to match umicrosite_vendor_register, but that didn’t work.

My IndexController is very simple:

$this->loadLayout()->renderLayout();

I guess what I’m missing is where the Magneto tells the register page to render in 1 column and the index page to render in 3 columns. I’ve spent all day trying to figure out where this happens, but to no avail.

Any suggestions as to where I should look?

A: 

You should add something like this to the layout update xml:

<reference name="root">
  <action method="setTemplate">
    <template>page/1column.phtml</template>
  </action>
</reference>

You can also do it in the code with the following snippet:

$root = $this->getLayout()->getBlock('root');
$template = "page/1column.phtml";
$root->setTemplate($template);
silvo
Thanks worked perfectly, thanks!This is what I ended up with in my XML (if anyone else is curious):<umicrosite_index_index> <reference name="root"> <action method="setTemplate"> <template>page/1column.phtml</template> </action> </reference> <reference name="content"> <block type="core/template" template="unirgy/microsite/home.phtml" name="vendorHome" /> </reference> </umicrosite_index_index>
Mike