Skip to content

NicolasGraph/rah_flat

 
 

Repository files navigation

rah_flat

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.

Installing

Using Composer:

$ composer require rah/rah_flat:*

Or download a plugin package.

Requirements

  • Textpattern 4.6.0 or newer.
  • PHP 5.3.6 or newer.

Basics

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.

Preferences

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:

http://example.com/?rah_flat_key={yourKey}

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.

Changelog

Version 0.4.0 – upcoming

  • 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.

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.

About

Edit Textpattern's database contents and page templates as flat files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.9%
  • Other 0.1%