Help!

Or search support forum

What's Global Moxie?

Global Moxie is the hypertext laboratory of Josh Clark, a writer, programmer and designer whose projects include the Big Medium web content management system. Josh spins words and code from his multimedia studio in 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

iWork ’09: The Missing Manual

iWork ’09: The Missing Manual is my fun and comprehensive book about Apple’s remarkable word processor, presentation software, and spreadsheet program.
Order yours now.

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.

Beautiful

"Beautiful interface. Installed with absolutely no problem. I AM IMPRESSED."
—Tom Marks

"This CMS has proven to be great and adaptable to the designer's vision, making my life easier."
—Scott Jordison

"Big Medium is everything I hoped for and more, and we're receiving a lot of compliments on the site's functionality. Moreso, I'd like to thank you for your exemplary customer service. You truly made me feel that you had a personal stake in our implementation, and gave me the confidence that when we went live, everything would be perfect. If only every tech-related experience was like this one."
—Andrew McKay

More praise for Big Medium