Magento 1.9 – Access Variables from CMS Block Insertions

cmsmagento-1.9php-5.4variables

Magento 1.9

I am trying to add a form several times onto a CMS page with code similar to:

{{block type="core/template" template="page/html/jobappform.phtml"}}

But I want to pass a variable thru to the PHP in jobappform.phtml so I can differentiate between the different forms.

I have tried using:

{{block type="core/template" template="page/html/jobappform.phtml?a=1&b=2"}}

In the hope I get get at the variables with $_GET, but if I use this the form doesn't appear.

Is there a way of doing this:

{{block type="core/template" template="page/html/jobappform.phtml" a="1" b="2"}}

And then in jobappform.phtml can I get at variables a and b?

Best Answer

You can definitely use the code you pasted:

{{block type="core/template" template="page/html/jobappform.phtml" a="1" b="2"}}

And then in your template you can do:

$this->getA(); 
$this->getB();