How can I call a .phtml block on a specfic page in magento?

How to use test.phtml on the test page, I used the following code, but did not work

{{block type='core/template' name='Test' template='goodtest/test.phtml'}} 

But he didn’t show anything on the page. So did I miss something? I need to put some code in other files like page.xml or local.xml.

thanks

+3
source share
2 answers

your code looks good to be added to the CMS page. if you want to add the .phtml file to the .phtml file, you can use this. you do not need to add anything to the xml file

  <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('goodtest/test.phtml')->toHtml(); ?> 

thanks

+15
source

Try it. First, create a page on the CMS pages in the admin panel and add the following code to the contents of the CMS page. It will call the contents of this page in the main content area.

 {{block type='page/html' template='page/html/demo.phtml'}} 
0
source

Source: https://habr.com/ru/post/906296/


All Articles