如何将CMS页面的内容拉入静态块? [英] How would I pull the content of a CMS page into a static block?

查看:151
本文介绍了如何将CMS页面的内容拉入静态块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将CMS网页的内容拉入我的静态块,如果您知道这样做,我将不胜感激。

I want to pull the content of a CMS page into my static block, if you know of a way to do this I would be grateful.

推荐答案

没有测试这个,但它应该工作。如果您拥有cms页面(而不是标识符)的唯一ID:

Haven't tested this, but it should work. If you have the unique ID of the cms page (not the identifier):

$page = Mage::getModel('cms/page');
$page->setStoreId(Mage::app()->getStore()->getId());
$page->load($pageId);

否则,如果你有页面的标识符(例如URL key),使用这样:

Otherwise if you have the page's identifier (i.e. URL key), use something like this:

$page->load($pageIdentifier,'identifier');

然后完成:

$helper = Mage::helper('cms');
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($page->getContent());
return $html;

== EDIT ==

添加了Alan

这篇关于如何将CMS页面的内容拉入静态块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆