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













0















I have two CMS pages in magento 2 . I want to call one cms page to another cms page.



anyone can help me.










share|improve this question

























  • 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
















0















I have two CMS pages in magento 2 . I want to call one cms page to another cms page.



anyone can help me.










share|improve this question

























  • 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














0












0








0








I have two CMS pages in magento 2 . I want to call one cms page to another cms page.



anyone can help me.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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










1 Answer
1






active

oldest

votes


















0














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>


enter image description here



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()];
}
}





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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>


    enter image description here



    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()];
    }
    }





    share|improve this answer




























      0














      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>


      enter image description here



      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()];
      }
      }





      share|improve this answer


























        0












        0








        0







        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>


        enter image description here



        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()];
        }
        }





        share|improve this answer













        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>


        enter image description here



        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()];
        }
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 10 hours ago









        Sohel RanaSohel Rana

        22.3k34460




        22.3k34460






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

            How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

            變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...