【问题标题】:Magento subscribe form not showingMagento 订阅表格未显示
【发布时间】:2014-04-14 09:21:07
【问题描述】:

我正在开发一个网站,但我的页面没有显示订阅表单...

我已将此添加到我的 newsletter.xml 中:

    <!-- Mage_Newsletter -->
    <reference name="newsletter">
        <block type="newsletter/subscribe" name="news.subscribe" as="news.subscribe" template="newsletter/subscribe.phtml"/>
    </reference>

</default>

这是我的 news_home.phtml:

  <section id="news_and_fun_home" class="block small">
    <div class="block-top"></div>
    <div class="block">
        <a href="https://plus.google.com/u/0/105681634975039284210/posts" target="_blank"><div class="follow-google"></div></a>
        <?php echo $this->getChildHtml('news.subscribe'); ?>
    </div>

    <div class="block-bottom"></div>
</section>

我是 magento 的新手...有人能解释一下我该怎么做吗?

这也不行:

<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>

【问题讨论】:

  • 是的,我确实刷新了缓存
  • 您能否确认一下,news.homeblock 是否正常工作???
  • 也发布您的更新布局句柄
  • 如果直接调用 phtml 不起作用,则清除缓存
  • 这样做了,还是不行……太奇怪了

标签: php xml magento


【解决方案1】:

首先,检查xml文件中的news_home.phtml文件reference name is newsletter 如果,你要显示这个块,那么你应该调用

&lt;?php echo $this-&gt;getChildHtml("news.subscribe"); ?&gt; 在 参考块newsletter (&lt;reference name="newsletter"&gt;)的phtml文件

【讨论】:

  • 参考名称“newsleter”,检查一下
  • 更改 news.subscribe 为任何其他名称
  • 将别名更改为 as="news_subscribe" 也在 news_home.phtml 中更改
【解决方案2】:

在 newsletter.xml 中:

<default>
        <!-- Mage_Newsletter -->
        <reference name="left">
            <block type="newsletter/subscribe" name="left.newsletter" template="newsletter/subscribe.phtml"/>
        </reference>

    </default>

在 news_home.phtml 中:

<section id="news_and_fun_home" class="block small">
    <div class="block-top"></div>
    <div class="block">
        <a href="https://www.facebook.com/sluban.nl" target="_blank"><div class="follow-facebook"></div></a>
        <a href="https://twitter.com/slubaneurope" target="_blank"><div class="follow-twitter"></div></a>
        <a href="https://plus.google.com/u/0/105681634975039284210/posts" target="_blank"><div class="follow-google"></div></a>
        <?php echo $this->getLayout()
                    ->createBlock("newsletter/subscribe")
                    ->setTemplate("newsletter/subscribe.phtml")
                    ->toHtml();
        ?>
    </div>

并检查您的 magento/app/design/frontend/Your Theme/default/layout/local.xml

如果在下面找到,请评论它:

<remove name="left.newsletter"/>

【讨论】:

    猜你喜欢
    • 2021-07-22
    • 1970-01-01
    • 2014-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-21
    • 2018-02-06
    • 2015-06-10
    相关资源
    最近更新 更多