CMS – How to Execute PHP Code in CMS Page

cms

I'm new working with Magento, and I was wondering if there's any way I can create a CMS page that uses PHP code. I mean,the page I need to create is something like an About Us, with a short description and a pretty simple contact form. Now, I tried to create it in the CMS section but it only allows me to use HTML code.

Am I doing it the wrong way? What would be the right way? Create a Module? A Block with the Form?

Any suggestions are truly appreciated.

Thanks.

Best Answer

The cms pages do not allow php code.
You can create a template to display your content and you can include it in the page like this:

{{block type="core/template" template="path/to/template.phtml"}}

But in your case you want to have a form and you need also something to handle the form submission.
For this I recommend creating a module.
Here is a small example that does exactly that. It shows you how to create a module with a form in it and handle the form submission.