Magento News

 

Magento use own handle in widgets doesn’t work

Hi,
I find that I can add own layout handles with this script:

$this->getLayout()->getUpdate()->addHandle('myhandle');

Then I checked Alan Storm Layout viewers: http://alanstorm.com/2005/projects/MagentoLayoutViewer.tar.gz

?showLayout=handles

Handles For This Request

  1. default
  2. cms_page
  3. STORE_default
  4. THEME_frontend_default_default
  5. cms_index_index
  6. page_two_columns_left
  7. customer_logged_out
  8. myhandle

There was my handle, but my custom layout xml didn’t used.

Here is my xml:

<?xml version="1.0"?>
<layout version="0.1.0">

    <myhandle>
        <reference name="head">
          <action method="addJs"><script>test/your.js</script></action>
        </reference>
    </myhandle>
</layout>

This works fine, so the xml file is loaded:

<?xml version="1.0"?>
<layout version="0.1.0">

    <default>
        <reference name="head">
          <action method="addJs"><script>test/your.js</script></action>
        </reference>
    </default>
</layout>

What’s wrong?
Why doesn’t work this solution?

If it’s not the right way, how can I add custom css and javascript for the page where the widget used?

Magento use own handle in widgets doesn’t work

Possibly Related Posts:


 

Leave a Reply