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 ?

asked Jul 10, 2017 at 7:03

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

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.