I am creating a module for Widget like - Top 5 Products, Product of the Day, Best rated product, Random 5 product, latest product and this will be placed on external website via/in iframe, I don't want the output to be cached by FPC/Varnish
Which can be archived by
<block class="\Magento\Framework\View\Element\Template" template="sample:module::sampletemplate.phtml" name="sampleblock" cacheable="false" />
cacheable="false" is used
and I want only the block template no header, footer or content area just the module output, some thing in the image below.
Question : How can I create a controller with only module output, no header, footer, no css and js, no <head>, <body> tags, etc, and the output should not be cached ?
1 Answer 1
you can use this:
<?xml version="1.0" ?>
<page layout="empty" 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="Magento\Framework\View\Element\Template" name="sampleblock" cacheable="false" template="Namespace_Module::sampletemplate.phtml"/>
</referenceContainer>
</body>
</page>
-
this will create empty layout with no header, footer etc.Manish Joy– Manish Joy2017年07月10日 07:29:11 +00:00Commented Jul 10, 2017 at 7:29
-
plz give a thumbs up if its helpful.Manish Joy– Manish Joy2017年07月10日 07:29:40 +00:00Commented Jul 10, 2017 at 7:29
-
Thanks for you reply, though empty layout do not have header footer but it does have all the CSS and Js, it also content <head>, <body> tag, I only want the output of the widget block. nothing more.Arun Karnawat– Arun Karnawat2017年07月10日 07:46:33 +00:00Commented Jul 10, 2017 at 7:46
Explore related questions
See similar questions with these tags.