enloz
enloz

Reputation: 5824

Magento CMS Page - include external PHP script

I want to include external PHP script in Magento CMS Pages

e.g.

**http://myhost/magento/custom/script.php**

<?php echo "hello"; ?>

Result on Magento Page should be: "hello"

What would be the simplest way to do this?

Upvotes: 3

Views: 5509

Answers (2)

Peter O&#39;Callaghan
Peter O&#39;Callaghan

Reputation: 6186

The best way would probably be via the Layout Update XML section (on the design tab). You can either create a new block for your template php file, or use Mage_Core_Block_Template. Add this:

<reference name="content">
    <block type="core/template" name="my_template" template="pat/to/your/template" after="cms_page" />
</reference>

Upvotes: 8

MagePsycho
MagePsycho

Reputation: 2004

OR
You can use curly braces syntax in order to include .phtml file where you can write your PHP code as:

{{block type="core/template" name="my-template" template="path/to/your/template.phtml"}}

Thanks

Upvotes: 4

Related Questions