2

I'm having problems with getting a .phtml file that contains some php to show in a static block. I've been searching the web and SO for days but I still can't figure out what I'm doing wrong.

I have a static block called "block_product_secondary_bottom". In this block I have various html code and text which displays in the area that I want it to (on the product page). So I'm comfortable with setting up static blocks.

What I've tried to do is create a .phtml containg PHP and include this in the block. The .phtml file is located in "/app/design/frontend/default/default/template/myphp/myphpcode.phtml"

The .phtml file simply contains:

<?php 
echo "Here I will write my custom PHP code";
?>

In the static block above my text (that shows correctly) i've put:

12345:{{block type="catalog/product_view" template="myphp/myphpcode.phtml"}}

I've put the 12345: to test make sure I know where the code should be. This shows, but there is nothing after it.

Please could you point me in the right direction, like I said I've spent days trying to figure this out!

Thanks Chris

1 Answer 1

3

To insert template in cms page

 {{block type="core/template" name="my.block.name" template="myfolder/newfile.phtml"}}

try replacing "my.block.name" with "product.advertiser" and change template path as per your requirement.

1
  • Perfect! After literally days of trying to figure it out, it was because I didn't have the "name" section in the block. This helped me fix the issue! Commented Jan 21, 2016 at 8:11

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.