在展示Magento静态块时苦苦挣扎

时间:2015-02-25 12:48:09

标签: magento static-block

我购买了Magento主题。该主题包括显示新闻订阅静态块的主页。

此处显示CMS主页内容中用于显示该块的代码:
<div class="block-socials in-blog">{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml" }}</div>

这里是subscribe.phtml内容:

<div class="block block-subscribe social-block">
<div class="social-block-title">
    <span><?php echo $this->__('Newsletter') ?></span>
</div>
<div class="social-block-border">&nbsp;</div>
<div class="social-block-join-content">
    <?php echo $this->__('Sign Up for Our Newsletter:') ?>
    <div class="social-block-join-form">
        <form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
            <p>
                <input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email cms-block-join" />
            </p>
            <div class="actions">
                <button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button cms-block-join"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
            </div>
        </form>
    </div>
<script type="text/javascript">
//<![CDATA[
    var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
//]]>
</script>
</div>

它工作得很好(有验证,将数据发送到数据库)(附加图像)。但是我想把它放在一个不同的位置。该位置是一个具有四个插槽的块,每个插槽可以容纳一个静态块(附加图像),可以通过下拉菜单在Magento后端中选择(所有CMS静态块都显示在该菜单下)。 所以我创建了从该下拉菜单中选择的新静态块。但我正在努力将内容放在那里: 如果我放置以下内容: {{block type="newsletter/subscribe" template="newsletter/subscribe.phtml" }} 然后就是这样显示(无论我是否添加相应的div)。

如果我将来自subscribe.phtml的静态块的内容放入我创建的静态块中,它会出现,但它不起作用(而不是验证数据,它搜索特定页面,而url栏看起来像这样: baseurl /&lt;?php%20 echo%20 $ this-&gt; getFormActionUrl()%20?&gt;(无空格))

你可以帮我创建一个带有subscribe.phtml模板内容的新静态块,以便它能像原来那样工作。

非常感谢你。

first image second image

1 个答案:

答案 0 :(得分:0)

您可以将所有内容放在phtml文件中,并在您创建的静态块中调用该phtml文件。下面是将静态块中的phtml文件包含在内的代码。

{{block type="core/template" template="page/html/YOUR_FILE_NAME.phtml"}}

现在将此静态块包含在您想要的插槽中。

希望这会有所帮助。

相关问题