0

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.

enter image description here

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

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>
3
  • this will create empty layout with no header, footer etc.
    – Manish Joy
    Jul 10, 2017 at 7:29
  • plz give a thumbs up if its helpful.
    – Manish Joy
    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. Jul 10, 2017 at 7:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.