문제

As we know that we're able to render html content up in front as using below code

echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('identifier')->toHtml();

but as I require to display as html content.

For eg: <div>This is static Block </div>

Like this up in front.

도움이 되었습니까?

해결책

You may try this

$blockHtml = $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('identifier')->toHtml();
echo $block->escapeHtml($blockHtml);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top