Magento将静态块加载到php文件中

use*_*179 4 php magento

我创建了一个加载在iframe上的自定义表单.它还有send.php表单,也是一个自定义文件.我需要作为感谢信息来加载静态块中的内容,以便客户端可以更改它.

如何将静态块中的文本加载到自定义php文件中?

谢谢

Mar*_*ius 14

试试这个:

require_once 'path/to/'.'Mage.php'; //replace 'path/to' with the relative path to your Mage.app file
echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('some_block_id')->toHtml();
Run Code Online (Sandbox Code Playgroud)


Ric*_*rds 6

{BLOCK_IDENTIFIER}是静态块的id:

echo Mage::getModel('cms/block')->load('{BLOCK_IDENTIFIER}')->getContent();
Run Code Online (Sandbox Code Playgroud)