Help!

Or search support forum

What's Global Moxie?

Global Moxie specializes in mobile design strategy and user experience for a multiscreen world. We offer consulting services, training, and product-invention workshops to help creative organizations build tapworthy mobile apps and effective websites. We're based in Brooklyn, NY. Learn more.

On Shelves

Books by Josh Clark

Tapworthy: 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?

Important: Sales, service, and support of Big Medium are no longer offered. More details.

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.

Blown Away

“I’m blown away by Josh Clark’s deep understanding of the iPhone user experience.”
—Jürgen Schweizer, founder of Cultured Code, maker of Things iPhone app

“It’s rare to find a person like Josh Clark who speaks so intently to the topic of interface design and mobile devices.”
—John Maeda, president of Rhode Island School of Design

“If you have time to read only one book on what makes apps successful, it is Tapworthy by Josh Clark.”
—Andreas Sjostrom, manager of mobile solutions, Sogeti

More praise for Tapworthy