【问题标题】:Magento header childhtml dropdownMagento 标头 childhtml 下拉菜单
【发布时间】:2014-01-28 23:38:27
【问题描述】:

当我单击标题中的链接时,如何将子 html 块添加为弹出窗口?在此链接中,我想让“我的帐户”有一个类似于悬停在心形和包图标上的下拉菜单。

当我尝试创建一个新的 .xml 文件时,我使用了:

<layout>
    <default>
        <reference name="head">
            <action method="addCss"><stylesheet>css/popup.css</stylesheet></action>
              <action method="addJs"><script>dojo.xd.js</script></action>
        </reference>
                 <reference name="header">
            <block type="myaccountpopup" name="myaccountpopup" template="myaccountpopup.phtml" />
        </reference
    </default>
</layout>

我还在链接后面加了&lt;?php echo $this-&gt;getChildHtml('myaccountpopup') ?&gt;也没用。

问题是

  1. 如何确定块类型?
  2. 什么是让它工作的正确方法?

【问题讨论】:

    标签: php jquery html css magento


    【解决方案1】:

    可能是您缺少正确的 js 标记,包括:

    <action method="addJs"><script>dojo.xd.js</script></action> // <--- Here Error
    

    【讨论】:

      【解决方案2】:

      默认块类是Mage_Core_Block_Template。如果任何 phtml 文件具有来自块类的渲染。 示例:-&lt;block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/&gt; 这里topmenu.phtml 有调用类Mage_Page_Block_HTML_Topmen 在您的代码中,您没有关闭引用标记。

      <reference name="header">
          <block type="core/template" name="myaccountpopup" template="myaccountpopup.phtml" />
      </reference>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多