2

I have created a page using the CMS (via Admin Portal) and now I want to add a custom block (programmed) to the page. You can see the created page here: enter image description here

My structure is the following:

enter image description here

but unfortunately I do not get the created CMS page with the block connected. I thought that maybe the Router ID has to be set to cms. But I don't know exactly how to adjust the files accordingly. Do you have any ideas?

asked Apr 2, 2020 at 8:29

1 Answer 1

2

Using module you can add your block like this.

Add in your layout file

summary_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <body>
 <referenceContainer name="content">
 <block class="VenAbf\ModAbf\Block\Index" name="call_block_name" template="VenAbf_ModAbf::testinase.phtml" />
 </referenceContainer>
 </body>
</page>

Using admin panel go to you cms page and click on edit and add this line and click on save

{{block class="VenAbf\ModAbf\Block\Index" template="VenAbf_ModAbf::testinase.phtml"}}

Please run magento command after adding above code.

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:f

I Hope This Helps You.

answered Apr 2, 2020 at 8:55
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.