PHP on CMS across all themes in Magento

I'm new to Magento and I've been converting an existing bespoke web site to Magento.

I have occasional PHP includes on the existing site that need to be inserted into CMS pages on the new site. I've managed to do this by adding blocks that call a phtml file within the layouts directory. However, I would like to make sure that the PHP include is available to all themes. The way I've done it means that it's only easily available to the theme I'm using - I need to develop a mobile theme and use the same PHP includes.

I've spent some time looking at modules and widgets. I finally got my head around widgets but now seem unable to insert PHP into it - it seems it only supports HTML so I'm back to square one.

Can someone please explain what the best practice is and possibly expand on that so I can implement it in my site?
LVL 1
edz_pgtAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vimal DMSenior Software EngineerCommented:
Hi,

You can write your own PHP code in PHTML, it will work same as php file in magento, you can just copy and paste what ever you have in php file to phtml and fixing if there is any issues.
edz_pgtAuthor Commented:
Yet again, I've ended up answering my own question in the absence of a quality EE contribution.

The includes need to be located in the default/default directory structure rather than the default/theme directory. This way, all themes will see the files.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edz_pgtAuthor Commented:
I seem to be struggling to get quality responses from EE these days. Not too sure whether continuing my subscription is of any value.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.