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.
- Textpattern 4.6.0 or newer.
- PHP 5.3.6 or newer.
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.
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 hook URL. Importing is done when the URL is accessed. The URL follows the format of:
http://example.com/?rah_flat_key={yourKey}
Where http://example.com/
is your site’s URL, and {yourKey}
is the security key you specified.
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.
- Added: Import template variables.
- Added: Import translation strings.
- Added: Reads template files recursively, allowing the use of organizational sub-directories.
- Added: Use the parent directory as the form type, if it’s not specified in the filename itself.
- Added: Do not delete essential forms from the database.
- Added: Do not delete pages or styles that are used by a section.
- Now requires Textpattern 4.6.0 or newer.
- 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 toRah_Flat_Import_ImportInterface
.
- Reworked.
- Initial release.