{"id":424,"date":"2015-04-16T14:05:54","date_gmt":"2015-04-16T13:05:54","guid":{"rendered":"http:\/\/dknzdesign.com\/?p=424"},"modified":"2015-04-23T12:00:14","modified_gmt":"2015-04-23T11:00:14","slug":"how-to-call-block-in-phtml-file-in-magento","status":"publish","type":"post","link":"https:\/\/dknzdesign.com\/de\/blog\/magento\/how-to-call-block-in-phtml-file-in-magento\/","title":{"rendered":"So rufen Sie einen Block in einer phtml-Datei in Magento auf"},"content":{"rendered":"<p>It is sometime really needed to show the custom block or any static block in the PHML file. Generally on the magento websites home page or any other pages uses one column layout and it is needed to show the left of right sidebar blocks like compare products, poll, cart block which are there in one column left or one column right side layouts in the one column layout so here are the examples to show core template files and static blocs in PHMTL and CMS pages.<\/p>\n<p>1) To call the core template file in phtml file in magento<\/p>\n<pre>getLayout()-&gt;createBlock(\u2018core\/template\u2019)-&gt;setTemplate(\u2018templateFolder\/yourtemplate.phtml\u2019)-&gt;toHtml(); ?&gt;<\/pre>\n<p>2) To call the core template file in CMS page<\/p>\n<pre>{{block type=\u201dcore\/template\u201d template=\u201dtemplateFolder\/your_template.phtml\u201d}}<\/pre>\n<p>3) To call a static block in phtml file in magento<\/p>\n<pre>getLayout()-&gt;createBlock('cms\/block')-&gt;setBlockId('your_block_id')-&gt;toHtml() ?&gt;<\/pre>\n<p>4) To call a static block in CMS page<\/p>\n<pre>{{block type=\"cms\/block\" block_id=\"your_block_id\"}}<\/pre>\n<p>Developers can easily display the static block or their custom block in any phtml file or any CMS page through that one line of code.<\/p>","protected":false},"excerpt":{"rendered":"<p>Manchmal ist es wirklich notwendig, den benutzerdefinierten Block oder einen statischen Block in der PHML-Datei anzuzeigen. Im Allgemeinen wird auf der Startseite der Magento-Website oder auf anderen Seiten ein Spaltenlayout verwendet, und es ist erforderlich, links von rechts Seitenleistenbl\u00f6cke anzuzeigen, wie z.<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[96,43,95,97],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-magento","tag-coding","tag-magento","tag-phtml","tag-template-files"],"_links":{"self":[{"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/comments?post=424"}],"version-history":[{"count":1,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":425,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/posts\/424\/revisions\/425"}],"wp:attachment":[{"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/media?parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/categories?post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dknzdesign.com\/de\/wp-json\/wp\/v2\/tags?post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}