Textpattern tips, tutorials and code snippets

Develop sites with version control

I used to edit TXP forms and TXP pages in my chosen editor, then copy/paste them into the Admin interface in TXP, save and refresh.

Now I edit TXP forms and TXP pages in my chosen editor, save and refresh.

I can do this thanks to the cnk_versioning plugin.

I discovered this plugin via some kindly people on the TXP support forum and it has become an essential part of work flow.

An orphan plugin?

cnk_versioning is listed as an ‘ORPHAN’ plugin on the TXP forum, but as the thread shows there are a few people helping out here and there to keep it alive. And although I usually get the jitters at the thought of relying on an orphan plugin, as this functionality aids me with site development rather than providing key functionality for the actual running of a site, I don’t worry.

How do you use it?

The forum thread provides all the help you likely need, reading it I was able to get it working and was astounded how much smoother development felt.

The only problem was that when I went to install it again for another site, I had problems. I’m not sure why, but I think it was to do with how I installed, so I experimented and found an answer that worked for me.

Some kindly people had edited the code so it would work with TXP 4.4.1, I grabbed a copy of that code and the installed-code in my installation that worked and then set about trying to install on a new site. After a few failures and database restores I found the steps that worked and so I documented them for anyone else.

Setting up cnk_versioning

1. Create the folders

/my-nice-folder/cnk_templates/css
/my-nice-folder/cnk_templates/forms
/my-nice-folder/cnk_templates/pages

2. Install the plugin but do not activate, the plugin code I use is cnk_versioning for txp 4.41

3. Edit the plugin code, essentially delete it all and past in cnk_versioning for txp 4.41 – modified code once plugin is installed

4. Check you are happy with the locations and file extensions

$CNK_VER_OUTPUT_PATH = 'my-nice-folder/cnk_templates/'; //e.g. 'textpattern/_templates/versioning/'
$CNK_VER_EXT = 'php';
$CNK_VER_EXT_CSS = 'css';

5. Activate the plugin

6. Click ‘Presentation’ and then go to ‘Versioning’

7. Do NOT click ‘Install’ but do click ‘Write pages & forms to files‘ — you see errors, no matter

8. Now click ‘Install’

9. Your folders should now hold files to reflect the Forms, Pages, CSS.

I also decided to upload a copy of the plugin code and the installed-plugin code, as I note in my post:

This is likely a cringe-making way to install this plugin, but I value its functionality SO much that when I found these steps worked I wrote them up so I could repeat them like a monkey each time I needed the plugin installed.

Footnote

Thank you to all TXPers who have helped me find this plugin and get it working.

I really hope the valuable functionality it provides makes it’s way into future versions of TXP.

2 Comments Comment feed

  • Uli
  • 9 February 2012

Jonathan, Alan’s email address should be shortened to his website address (in URL field).

@uli – thanks for spotting that!

Add a comment

Use Textile help to style your comments