looking for some help. I have created a custom page with url:
http://localhost/magento2/hello_mvvm/hello/world
and there is view/frontend/layout/hello_mvvm_hello_world.xml code:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <referenceBlock name="content"> <block template="content.phtml" class="Pulsestorm\HelloWorldMVVM\Block\Main" name="pulsestorm_helloworld_mvvm"/> </referenceBlock> </page>
some how I need to add my custom created widget to my custom created above mentioned page in the footer container place, can some one assist me?
My custom widget placed in app/code/Toptal/CustomWidget
You need to set referenceContainer as Footer-container for keep your widget in footer section,
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <referenceContainer name="footer-container"> <block template="content.phtml" class="Pulsestorm\HelloWorldMVVM\Block\Main" name="pulsestorm_helloworld_mvvm"/> </referenceContainer> </page>
Hello, thanks for you reply, but I need to add a custom widget, with template name
simplewidget.phtml
, class then should be I think :
Toptal\CustomWidget\Block\Widget\Samplewidget
But I dont now name of this block, how to get it? My code looks now:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <referenceBlock name="content"> <block template="content.phtml" class="Pulsestorm\HelloWorldMVVM\Block\Main" name="pulsestorm_helloworld_mvvm"/> </referenceBlock> <referenceContainer name="footer-container"> <block template="samplewidget.phtml" class="Toptal\CustomWidget\Block\Widget\Samplewidget" name=""/> </referenceContainer> </page>