Topics

Get page content by ID

Usually page content is placed on the page using <?php echo ipBlock('main') ?> function. But his function prints the content of the current page. Current page is not defined when you are in AJAX (or controller action) context. Here is a small code snippet to get page content by it's ID

<?php 
$pageId = xx;
$revision = \Ip\Internal\Revision::getPublishedRevision($pageId);
$languageId = 0; //that means not static
$managementState = false;
$blockContent  = \Ip\Internal\Content\Model::generateBlock('main', $revision['revisionId'], $languageId, $managementState);
        
 
comments powered by Disqus