1

I am trying to place my "contact us" form in another CMS page following this answer.
i.e.:

{{block type="core/template" name="contactForm" form_action="{{store direct_url='contacts'}}/index/post" template="contacts/form.phtml"}}

But this is all I get as the output:

enter image description here

EDIT enter image description here

I am placing the variable from the above answer in the "content" of the CMS page.

3
  • Your code is write you just used in wrong place see my answer
    – Kumar M
    Sep 21, 2018 at 9:29
  • 1
    @jurgis, the answer from Kumar M is right. Sep 21, 2018 at 9:34
  • @MohitKumarArora whats wrong with using Ansar Husain answer? (Since that works for me) Sep 21, 2018 at 9:47

2 Answers 2

2

You must have pasted it in editor mode which make any text into html entity encoded format.

So try disabling editor mode and then paste it in textarea(not in wysying editor) and save.

Also as I can see you have used {{ and }} inside {{ and }} so script parser will think its getting closed when 1st time }} was called. That's why next to 1st }} other content is visible.

Simply means you can not put a variable inside a variable; here {{block}} will be treated as variable as well.

You can use form_action like this /contacts/index/post.

3
  • I also thought so, but I cant seem to get it working either way. Please see my edit Sep 21, 2018 at 9:37
  • I have updated my answer
    – Kumar M
    Sep 21, 2018 at 10:12
  • ah okay, this is the comprehensive answer I was looking for. Thank you Sep 21, 2018 at 10:22
0

Use below code it will work for you

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

9
  • this does work, but do you know why I dont need to use {{store direct_url='contacts'}} ? Sep 21, 2018 at 9:33
  • @JurģisTomsLiepiņš, Magento is not able to parse {{ within another {{...}}. Sep 21, 2018 at 10:10
  • @MohitKumarArora well thats how it looks to me too, but other people are claiming it works for them.... Sep 21, 2018 at 10:11
  • I have created a custom PHP file under app/design/frontend/default/theme/template/page/top_selling_items_list/top_selling.php, what is my block type in cms. mine getting error - {{block type="top_selling_items_list" template="top_selling_items_list/top_selling.php"}} @Ansar Husain
    – Gem
    Dec 6, 2019 at 9:26
  • change type="top_selling_items_list" use here class=" block class path " like Vendor\Module\Block\ClassName @Gem Dec 6, 2019 at 10:16

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.