Using files for page templates in Textpattern is a post on The Hickensian

One of Textpattern’s drawbacks has always been that page templates are saved in the database. Editing them means using the textarea in the TXP admin interface, but I’m sure most people would prefer to use their favourite text editor.

Here’s a workaround that works in TXP 4.2.0 (I haven’t tried other versions).

  1. Enable ‘Allow PHP in pages?’ in Advanced Preferences if you haven’t already
  2. Set up your sections and corresponding page templates as you want them
  3. Copy and paste everything in your page template into a php file (such as ‘template.php’)
  4. Create a ‘pages’ folder in your textpattern directory and save the file there
  5. Replace the content of your page template in TXP admin with:
<txp:php>echo parse(file_get_contents(txpath.'/pages/template.php'));</txp:php>

From there on in, you can edit the php file. There may be a performance hit doing this, but all TXP tags work. Much easier!

The Hickensian is the journal of Jon Hicks, one half of the creative partnership Hicksdesign. See the work we do.

AD by FUSION

Jobs

Hicksdesign doesn't have any vacancies, but these fine folk do:

    Via Authentic Jobs Come in, we're hiring!

    playlist

    See more on last.fm

    Contact

    Hicksdesign

    73a High Street

    Witney

    Oxfordshire, UK

    OX28 6JA

    +44 (0)7917 391 536

    Download vCard

    Happy Cog Hosting