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

asked Jan 20, 2016 at 19:18

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.

answered Jan 20, 2016 at 20:04
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.