Reputation: 95
I have created a custom form that loads on an iframe. It also has the send.php form which is a custom file also. I need as a thank you message though to load the content from a static block so client can change it.
How can I load the text from the static block into a custom php file?
Thank you
Upvotes: 4
Views: 17508
Reputation: 11
I used the following if it helps someone else
require_once ($_SERVER["DOCUMENT_ROOT"] . "/dev/app/Mage.php"); //remove dev if you want the Mage.php from root
echo Mage::app()->getLayout()->createBlock('cms/block')>setBlockId('some_block_id')->toHtml();
Upvotes: 1
Reputation: 15206
Try this:
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();
Upvotes: 14
Reputation: 3097
{BLOCK_IDENTIFIER} is the id of the static block:
echo Mage::getModel('cms/block')->load('{BLOCK_IDENTIFIER}')->getContent();
Upvotes: 6