-
Notifications
You must be signed in to change notification settings - Fork 6
/
TemplateProcessorPage.php
33 lines (27 loc) · 1.27 KB
/
TemplateProcessorPage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$this->_state->setAreaCode('frontend');
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND);
// $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
$page = $this->_objectManager->create('\Magento\Cms\Model\Page');
$filterProvider = $this->_objectManager->create('Magento\Cms\Model\Template\FilterProvider');
$storeManager = $this->_objectManager->create('Magento\Store\Model\StoreManagerInterface');
$pageId = 1; // Id of Page you want get content
$storeId = $storeManager->getStore()->getId();
$page->setStoreId($storeId)->load($pageId);
$content = $page->getContent();
$html = $filterProvider->getBlockFilter()->setStoreId($storeId)->filter($content);
echo $html;
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);