Textpattern CMS templates as flat files

Installs: 65

Dependents: 0

Stars: 16

Watchers: 7

Forks: 7

Open Issues: 3

Type: textpattern-plugin

0.3.0 2014-03-28 12:10 UTC


Download | Packagist | Donate

This plugin makes your Textpattern CMS database more flat, manageable and editable. Edit templates, forms, pages, preferences and sections as flat files. Use any editor, work in teams and store your website’s source under your favorite version control system.

Warning: this plugin will permanently remove your current templates when activated.


Using Composer:

$ composer require rah/rah_flat:*

Or download a plugin package.


Rah_flat imports normal, flat files from a specified directory to your Textpattern database. This, in essence, lets you to edit your database contents from any regular editor and store the source as flat files.

Rah_flat comes with built-in support for a few essential content types: styles, forms, pages, preferences and sections. See the templates directory on GitHub for an example how this all works.

Your flat files are imported to the database:

  • Automatically on the background when the site is either in Debugging or Testing mode.
  • When the public callback hook URL is accessed. The URL can be used for deployment.

If you want to exclude a certain content type from importing, just don’t create a directory for it. No directory, and rah_flat will leave the database alone when it comes to that content type.


The plugin has set of preferences you can find on Textpattern’s normal preferences panel.

Path to the templates directory

Specifies path to the root templates directory containing all the content-type specific directories. This path is relative to your ‘textpattern’ installation directory. For example, a path ../templates would point to a directory located in the same directory as your textpattern directory and the main index.php file.

Security key for the public callback

Security key for the public callback hook URL. Importing is done when the URL is accessed. The URL follows the format of:


Where http://example.com/ is your site’s URL, and {yourKey} is the security key you specified.

Toolshed notice

This is a toolshed project. Experimental and not part of the main supported product line of Rah. Not yet at least. Please use at your own risk.


Version 0.3.0 – 2014/03/28

  • Added: Drop access to a admin-side panel only if the specific content-type is active and has a directory set up.
  • Added: Invokable rah_flat.import callback event.
  • Added: Sections and preferences get their names from the filename.
  • Added: Preferences are always just updated, no strands are created.
  • Added: Preference fields that are not specified in a file are kept as-is in the database.
  • Added: French translation by Patrick Lefevre.
  • Changed: Renamed confusing Rah_Flat_Import_Template interface to Rah_Flat_Import_ImportInterface.

Version 0.2.0 – 2014/03/19

  • Reworked.

Version 0.1.0 – 2013/05/07

  • Initial release.