How to call a CMS page in another CMS page in magento 2CMS Home Page appears below custom Default Home on one...
Are all UTXOs locked by an address spent in a transaction?
Can an earth elemental drown/bury its opponent underground using earth glide?
What is a term for a function that when called repeatedly, has the same effect as calling once?
Formatting a table to look nice
Can the Shape Water Cantrip be used to manipulate blood?
How can I be pwned if I'm not registered on the compromised site?
Is divide-by-zero a security vulnerability?
Was it really inappropriate to write a pull request for the company I interviewed with?
Can we carry rice to Japan?
How can I highlight parts in a screenshot
How to mitigate "bandwagon attacking" from players?
Why would the IRS ask for birth certificates or even audit a small tax return?
Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?
Meaning of word ягоза
Can a space-faring robot still function over a billion years?
GDAL GetGeoTransform Documentation -- Is there an oversight, or what am I misunderstanding?
How to merge row in the first column in LaTeX
Is there a math equivalent to the conditional ternary operator?
Why is my Contribution Detail Report (native CiviCRM Core report) not accurate?
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
The need of reserving one's ability in job interviews
Plagiarism of code by other PhD student
Where is this quote about overcoming the impossible said in "Interstellar"?
Why did the Cray-1 have 8 parity bits per word?
How to call a CMS page in another CMS page in magento 2
CMS Home Page appears below custom Default Home on one store viewHow to add custom fields to magento cms page's Page Information tab?How to get theme specific cms page links in front end?Add cms url suffixMagento 2.0 Call cms page in phtml fileMagento 2 cms page cms page IdentifierMagento 2 : How to Fetch CMS Page Content Using SearchHow to add google rich snippets Microdata in CMS pages in magento 1.9Magento 2 page redirection to CMS pagesAdd canonical link to CMS page | Trailing slash added after URL
I have two CMS pages in magento 2 . I want to call one cms page to another cms page.
anyone can help me.
magento2 cms
add a comment |
I have two CMS pages in magento 2 . I want to call one cms page to another cms page.
anyone can help me.
magento2 cms
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago
add a comment |
I have two CMS pages in magento 2 . I want to call one cms page to another cms page.
anyone can help me.
magento2 cms
I have two CMS pages in magento 2 . I want to call one cms page to another cms page.
anyone can help me.
magento2 cms
magento2 cms
edited 4 mins ago
adi maheshwary
92
92
asked 16 hours ago
Sarvesh TiwariSarvesh Tiwari
369322
369322
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago
add a comment |
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Add following xml in Design -> Layout Update XML
<referenceContainer name="content">
<block class="SRMagentoCommunityBlockPage" name="another_cms_page" after="cms_page">
<arguments>
<argument name="page_id" xsi:type="number">7</argument>
</arguments>
</block>
</referenceContainer>
Now create app/code/SR/MagentoCommunity/Block/Page.php
<?php
namespace SRMagentoCommunityBlock;
use MagentoCmsApiPageRepositoryInterface;
class Page extends MagentoFrameworkViewElementAbstractBlock implements
MagentoFrameworkDataObjectIdentityInterface
{
/**
* @var MagentoCmsModelTemplateFilterProvider
*/
private $filterProvider;
/**
* @var PageRepositoryInterface
*/
private $pageRepository;
/**
* Page constructor.
*
* @param MagentoFrameworkViewElementContext $context
* @param MagentoCmsModelTemplateFilterProvider $filterProvider
* @param PageRepositoryInterface $pageRepository
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementContext $context,
MagentoCmsModelTemplateFilterProvider $filterProvider,
PageRepositoryInterface $pageRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->filterProvider = $filterProvider;
$this->pageRepository = $pageRepository;
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$pageId = $this->getPageId();
$cmsPage = $this->pageRepository->getById($pageId);
$this->setPage($cmsPage);
return parent::_prepareLayout();
}
/**
* Prepare HTML content
*
* @return string
*/
protected function _toHtml()
{
$html = $this->filterProvider->getPageFilter()->filter($this->getPage()->getContent());
return $html;
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
return [MagentoCmsModelPage::CACHE_TAG . '_' . $this->getPage()->getId()];
}
}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264670%2fhow-to-call-a-cms-page-in-another-cms-page-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Add following xml in Design -> Layout Update XML
<referenceContainer name="content">
<block class="SRMagentoCommunityBlockPage" name="another_cms_page" after="cms_page">
<arguments>
<argument name="page_id" xsi:type="number">7</argument>
</arguments>
</block>
</referenceContainer>
Now create app/code/SR/MagentoCommunity/Block/Page.php
<?php
namespace SRMagentoCommunityBlock;
use MagentoCmsApiPageRepositoryInterface;
class Page extends MagentoFrameworkViewElementAbstractBlock implements
MagentoFrameworkDataObjectIdentityInterface
{
/**
* @var MagentoCmsModelTemplateFilterProvider
*/
private $filterProvider;
/**
* @var PageRepositoryInterface
*/
private $pageRepository;
/**
* Page constructor.
*
* @param MagentoFrameworkViewElementContext $context
* @param MagentoCmsModelTemplateFilterProvider $filterProvider
* @param PageRepositoryInterface $pageRepository
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementContext $context,
MagentoCmsModelTemplateFilterProvider $filterProvider,
PageRepositoryInterface $pageRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->filterProvider = $filterProvider;
$this->pageRepository = $pageRepository;
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$pageId = $this->getPageId();
$cmsPage = $this->pageRepository->getById($pageId);
$this->setPage($cmsPage);
return parent::_prepareLayout();
}
/**
* Prepare HTML content
*
* @return string
*/
protected function _toHtml()
{
$html = $this->filterProvider->getPageFilter()->filter($this->getPage()->getContent());
return $html;
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
return [MagentoCmsModelPage::CACHE_TAG . '_' . $this->getPage()->getId()];
}
}
add a comment |
Add following xml in Design -> Layout Update XML
<referenceContainer name="content">
<block class="SRMagentoCommunityBlockPage" name="another_cms_page" after="cms_page">
<arguments>
<argument name="page_id" xsi:type="number">7</argument>
</arguments>
</block>
</referenceContainer>
Now create app/code/SR/MagentoCommunity/Block/Page.php
<?php
namespace SRMagentoCommunityBlock;
use MagentoCmsApiPageRepositoryInterface;
class Page extends MagentoFrameworkViewElementAbstractBlock implements
MagentoFrameworkDataObjectIdentityInterface
{
/**
* @var MagentoCmsModelTemplateFilterProvider
*/
private $filterProvider;
/**
* @var PageRepositoryInterface
*/
private $pageRepository;
/**
* Page constructor.
*
* @param MagentoFrameworkViewElementContext $context
* @param MagentoCmsModelTemplateFilterProvider $filterProvider
* @param PageRepositoryInterface $pageRepository
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementContext $context,
MagentoCmsModelTemplateFilterProvider $filterProvider,
PageRepositoryInterface $pageRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->filterProvider = $filterProvider;
$this->pageRepository = $pageRepository;
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$pageId = $this->getPageId();
$cmsPage = $this->pageRepository->getById($pageId);
$this->setPage($cmsPage);
return parent::_prepareLayout();
}
/**
* Prepare HTML content
*
* @return string
*/
protected function _toHtml()
{
$html = $this->filterProvider->getPageFilter()->filter($this->getPage()->getContent());
return $html;
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
return [MagentoCmsModelPage::CACHE_TAG . '_' . $this->getPage()->getId()];
}
}
add a comment |
Add following xml in Design -> Layout Update XML
<referenceContainer name="content">
<block class="SRMagentoCommunityBlockPage" name="another_cms_page" after="cms_page">
<arguments>
<argument name="page_id" xsi:type="number">7</argument>
</arguments>
</block>
</referenceContainer>
Now create app/code/SR/MagentoCommunity/Block/Page.php
<?php
namespace SRMagentoCommunityBlock;
use MagentoCmsApiPageRepositoryInterface;
class Page extends MagentoFrameworkViewElementAbstractBlock implements
MagentoFrameworkDataObjectIdentityInterface
{
/**
* @var MagentoCmsModelTemplateFilterProvider
*/
private $filterProvider;
/**
* @var PageRepositoryInterface
*/
private $pageRepository;
/**
* Page constructor.
*
* @param MagentoFrameworkViewElementContext $context
* @param MagentoCmsModelTemplateFilterProvider $filterProvider
* @param PageRepositoryInterface $pageRepository
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementContext $context,
MagentoCmsModelTemplateFilterProvider $filterProvider,
PageRepositoryInterface $pageRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->filterProvider = $filterProvider;
$this->pageRepository = $pageRepository;
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$pageId = $this->getPageId();
$cmsPage = $this->pageRepository->getById($pageId);
$this->setPage($cmsPage);
return parent::_prepareLayout();
}
/**
* Prepare HTML content
*
* @return string
*/
protected function _toHtml()
{
$html = $this->filterProvider->getPageFilter()->filter($this->getPage()->getContent());
return $html;
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
return [MagentoCmsModelPage::CACHE_TAG . '_' . $this->getPage()->getId()];
}
}
Add following xml in Design -> Layout Update XML
<referenceContainer name="content">
<block class="SRMagentoCommunityBlockPage" name="another_cms_page" after="cms_page">
<arguments>
<argument name="page_id" xsi:type="number">7</argument>
</arguments>
</block>
</referenceContainer>
Now create app/code/SR/MagentoCommunity/Block/Page.php
<?php
namespace SRMagentoCommunityBlock;
use MagentoCmsApiPageRepositoryInterface;
class Page extends MagentoFrameworkViewElementAbstractBlock implements
MagentoFrameworkDataObjectIdentityInterface
{
/**
* @var MagentoCmsModelTemplateFilterProvider
*/
private $filterProvider;
/**
* @var PageRepositoryInterface
*/
private $pageRepository;
/**
* Page constructor.
*
* @param MagentoFrameworkViewElementContext $context
* @param MagentoCmsModelTemplateFilterProvider $filterProvider
* @param PageRepositoryInterface $pageRepository
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementContext $context,
MagentoCmsModelTemplateFilterProvider $filterProvider,
PageRepositoryInterface $pageRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->filterProvider = $filterProvider;
$this->pageRepository = $pageRepository;
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$pageId = $this->getPageId();
$cmsPage = $this->pageRepository->getById($pageId);
$this->setPage($cmsPage);
return parent::_prepareLayout();
}
/**
* Prepare HTML content
*
* @return string
*/
protected function _toHtml()
{
$html = $this->filterProvider->getPageFilter()->filter($this->getPage()->getContent());
return $html;
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
return [MagentoCmsModelPage::CACHE_TAG . '_' . $this->getPage()->getId()];
}
}
answered 10 hours ago
Sohel RanaSohel Rana
22.3k34460
22.3k34460
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264670%2fhow-to-call-a-cms-page-in-another-cms-page-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't think it is possible, for these types of task we use static block and call static block in other cms pages
– Shoaib Munir
16 hours ago
actually i have used layout xml in another cms. so i can not use block instead of pages
– Sarvesh Tiwari
16 hours ago