2

我有一个小问题。我通过 fishpig 模块在我的 magento 商店中包含了一个 wordpress 博客。这很好用,但我想包括的是通过博客上的静态 cms 块的标题选项。我想我需要在主页博客的 phtml 中进行一些调整。app/design/frontend/base/default/template/wordpress/homepage.phtml

这是当前代码:

<div class="page-title blog-title <?php if (!$this->isFirstPage()): ?>not-<?php endif; ?>first-page<?php if ($this->isFirstPage() && $this->getTagLine()): ?> with-tagline<?php endif; ?>">
<h1><?php echo $this->escapeHtml($this->getBlogTitle()) ?></h1>
</div>
<?php if ($this->isFirstPage() && $this->getTagLine()): ?>
<p class="blog-desc blog-tag-line"><?php echo $this->escapeHtml($this->getTagLine()) 
?></p>
<?php endif; ?>
<div class="blog-home">
<?php echo $this->getPostListHtml() ?>
</div>

我玩弄了以下代码行,但我无法让它工作:

echo $this->getLayout()->createBlock('cms/block')->setBlockId('example_block')->toHTML();   

任何解决方案都会很棒!!

谢谢..

4

1 回答 1

1

You can display static blocks on the blog page using this code

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('example_block')->toHTML();?>

But first you need to create a static block in the admin panel. Admin-> Cms-> Static blocks. Then, after you have specified for the static block title, identifier, status and content, you'll need to replace the block identifier in your code to the identifier of the block that you created in the admin.

For example, you have created a block with identifier "blog_header" means the code to show this block on frontend, will be the

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('blog_header')->toHTML();?>
于 2012-10-25T11:22:20.967 回答