Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add php code to Static Block

Tags:

magento

I'm looking for a way to add php to a static block in Magento. I have tried numerous ways, but the editor changes

like image 345
user1137306 Avatar asked Apr 23 '12 21:04

user1137306


2 Answers

There is some quite limited short-tag support in static blocks, but you're probably better off calling a template file. You can do this inside your static block if you prefer:

{{block type="cms/block" block_id="your_block_identifier" template="your_path/template.phtml"}}

Then make a new template file and you can run your php stuff in there.

like image 150
pspahn Avatar answered Sep 20 '22 15:09

pspahn


This is a working way and eliminating unnecessary code

{{block type="core/template" template="page/urfile.phtml"}}
like image 34
Bhargav Mehta Avatar answered Sep 20 '22 15:09

Bhargav Mehta