0

I have created phtml file,

app/design/frontend/Smartwave/porto/Magento_Contact/templates/inquiry.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
/** @var \Magento\Contact\Block\ContactForm $block */
?>
<form>
  <div class="form-group">
    <label for="Full Name">Full Name:</label>
    <input type="text" class="form-control" id="name">
  </div>

  <div class="form-group">
    <label for="company name">Company Name:</label>
    <input type="text" class="form-control" id="companyname">
  </div>

<div class="form-group">
    <label for="email id">Email Id:</label>
    <input type="text" class="form-control" id="emailid">
  </div>

<div class="form-group">
    <label for="contact number">Contact Number:</label>
    <input type="text" class="form-control" id="contactnumber">
  </div>

<div class="form-group">
    <label for="product name">Product Name:</label>
    <input type="text" class="form-control" id="productname">
  </div>

<div class="form-group">

  <label for="comment">Comment:</label>
  <textarea class="form-control" rows="5" id="comment"></textarea>
</div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>
</form>

and call this file in a static block in the backend

<p>{{store url="inquiry-page"}}</p>
{{block class="Magento\Framework\View\Element\Template" template="porto/Magento_Contact/inquiry.phtml"}}

but only <p>{{store url="inquiry-page"}}</p> is working. Phtml block in not calling up

1

Try this piece of code in your static block.

{{block class="Magento\Contact\Block\ContactForm" name="inquiry.form"  template="Magento_Contact::inquiry.phtml"}}
1

For Example You can use Magento\Framework\View\Element\Template class to call phtml files

{{block class="Magento\Framework\View\Element\Template" template="Vendor_Module::myfiles/myfile.phtml"}}

To call advanced form use Magento\CatalogSearch\Block\Advanced\Form block class.

{{block class="Magento\CatalogSearch\Block\Advanced\Form" name="block_name" template="Magento_CatalogSearch::advanced/form.phtml"}}
0

You can call phtml file on CMS Static Block like below

{{block class="Block Name" template="Vendor_Module::phtml_file_name"}}

So, in your case it might be

{{block class="Magento\Framework\View\Element\Template" template="Magento_Contact::inquiry.phtml"}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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