I want to create a widget/static block with a countdown to the next shipment.

The shipment times should be changeable from the admin config, so I assume using PHP or PHTML are my options. (even though you can put JS code directly in a block, I believe it is not possible to call the values from config that way)

How do I make my static block execute a PHP code?


This is what I have:



echo "test";

Content of my static block:

{{block type="core/template" template="test.phtml"}}

The block doesn't display anything, what am I missing?

  • where did you displayed your static block?
    – Piyush
    Jul 4, 2017 at 9:03
  • On the home page Jul 4, 2017 at 9:05
  • worked, so silly of me to not try to flush cache first. Thank you for your help Jul 4, 2017 at 9:09

1 Answer 1


If you want to display system config value in static block you can use this code directly in static block -

{{config path="your_section/group/field"}}

Or if you want to execute a php code in static block then the best way is to add your php code in a phtml file and then call that phtml file in static block using

{{block type="your_module/your_block" template="your_template_path.phtml"}}
  • A dumb question perhaps, but if my phtml file path is app\design\frontend\default\default\template\test.phtml how much of it do I have to put in the "template="your_template_path.phtml"? Jul 4, 2017 at 8:23
  • in template the value you put is the path of your file after template/ directory, so in your case it will be only test.phtml
    – Piyush
    Jul 4, 2017 at 8:25
  • what do I replace the "your_module" and "your_block" with? Jul 4, 2017 at 8:52
  • if you have your custom module and block then your should add your module and block name here otherwise you can add core/template
    – Piyush
    Jul 4, 2017 at 8:53
  • Please check my edit Jul 4, 2017 at 9:01

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.