Help!

Or search support forum

What's Global Moxie?

Global Moxie is the hypertext laboratory of Josh Clark, a designer, developer, and author who offers workshops and consulting for iPhone app design. He’s also creator of Big Medium, a web content management system. Josh spins words and code from multimedia studios in Providence, RI, and Paris, France.

What's Big Medium?

Big Medium is flexible, easy-to-use server software for creating and editing websites directly from your browser. Check out the features or download now.

On Shelves

Books by Josh Clark

Tap Happy: Designing Great iPhone Apps

Best iPhone Apps: The Guide for Discriminating Downloaders

iWork ’09: The Mising Manual

Moxiemail

Enter your e-mail to receive occasional updates:

Can I include PHP code in my templates?

Question

Can I use PHP code in my templates?

Answer

Not directly. Big Medium generates .shtml pages, which are not parsed for PHP; any PHP code in those pages will not be processed.

You can, however, add server-side include tags to your templates to bring in PHP-generated markup from external files. You do this by moving each chunk of PHP code in your page into its own external PHP file, and then replacing that chunk of code with a SSI tag in the template. Here's how to do it.

Repeat these steps for every chunk of php code in your template:

  1. Copy and paste the code into an external file with its own unique name. For example, we'll call it: include.php

  2. Save the file to your webserver. For example, let's assume that your domain is example.com and you've saved this file here: www.example.com/php/include.php

  3. In your template, replace this chunk of PHP code with a SSI include tag like so:

    <!--#include virtual="/php/include.php" -->
    

The end result is that your template will include the results of each snippet of code from all of these external files.

Download Big Medium
Try it free for 30 days, or buy to unlock.

Cures Headaches

"I love Big Medium! Running a site with so many different types of content to keep fresh is very time consuming. I'm so glad that adding fresh articles is now the least of my headaches. Many thanks for all the hours I'll save with site upkeep!"
—Karen Denning

"The installation instructions are seriously good. I cannot remember seeing any better manual in the world of computers. Microsoft, Apple, Adobe, vBulletin, et al could benefit by taking a page from Global Moxie’s book!"
—Kathleen Tinkel

More praise for Big Medium