Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
Destry wrote #300894:
Yeah, I looked at the ReadMe file. I was just wanting to see a confirmation line like: “If you already use the original (orphaned) rah_flat, just update the plugin with this code, all will be fine.” ;)
All should be fine as far as you adopt the new structure by moving Txp forms in subfolders (and removing useless form types in form names).
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
I’ve been beta testing the new rah_flat on some real projects. I reacted thusly.
- Forms stored by types in subfolders Makes organizing editing projects with lots of forms in Sublime Text a snap.
- Support for custom prefs as variables… adi variables was an awesome way to let users contribute variables though admin, but the form gets overwritten each time aflat file import happens. Now you can have your rah_flat and let your customers edit variables through prefs.
- …and for textpacks No more hacking labels and ui elements though jquery.
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
mrdale wrote #300903:
I’ve been beta testing the new rah_flat on some real projects. I reacted thusly…
Thanks for your encouragements and suggestions while testing mrdale!
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
what does this WARNING actually mean?
Warning: this plugin will permanently remove your current templates when a valid path will be saved under the plugin prefs..
Makes me leery of trying this solution to editable flat files, as it seems to make permanent changes to the default settings. or am i over worrying the issue.
I have been using Mounee with EE.
…. texted postive
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
Hi bici. The warning is important and you should not ignore it.
The explanation is not so mysterious, though: think of rah_flat as a replacement of the Presentation > Forms and Presentation > Pages (and > Styles if you want) panes. Those panes are switched off and from now on, you edit those as files using the code editor of your choice. It’s an either/or situation.
rah_flat imports page and form templates from files on your file system and invisibly populates the form and page areas in textpattern with them. Any pages and forms already in there are cleared out. That is what the warning is about.
If you want to export your existing pages and forms first, try this exporter plugin (installer files here). You only need this once. But see the note for Destry below for an additional note.
Nicolas has extended rah_flat to enable you to add new prefs settings and variables (like adi_variables) but in the Admin > Preferences pane and not in a form. You don’t need to use those features at all if you don’t want to. Those don’t overwrite the settings but allow you to store settings you need for your site or site template with your file repository.
Destry wrote #300894:
“If you already use the original (orphaned) rah_flat, just update the plugin with this code, all will be fine.” ;)
I think the answer is not-quite, although I haven’t checked the most recent version. I think Nicolas changed the naming convention of the forms to match how phil does it which is different to how it was in the past. The new form naming convention is:
{form-type}.{form-name}.txp
The form name and form-type were previously the other way around. It’s not a big deal: you just need to rename your form files. In my form exporter, you can edit the plugin code to use the desired output format (see the Settings infos).
Since then Nicolas has introduced the ability to nest your txp_form files in subfolders for better organisation. I’ve not tested that yet.
TXP Builders – finely-crafted code, design and txp
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
jakob wrote #301136:
Any pages and forms already in there are cleared out. That is what the warning is about.
Exactly.
I think the answer is not-quite, although I haven’t checked the most recent version. I think Nicolas changed the naming convention…
You’re right, that’s what I meant but you don’t need any form type in form file names at all now; the form type is defined by the subfolder where the form file is. See Structure in the help file or take a look at the templates folder example.
Edited for corrections and clarity.
Last edited by NicolasGraph (2016-09-07 09:18:38)
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
Thanks all for the clarification. i’ll be trying it out later in the week on a brand new site to get the feel for the process.
…. texted postive
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
Moving over to rah_flat with all it’s flat file advantages is actually pretty straightforward. And it’s pretty easy to switch back if you don’t like it. Here’s how…
Moving over
- run mem_templates on your current install
- locate the pages, sections, styes, and forms directories it created
- in your forms directory remove the form type from the name for all forms… ie
myform.misc.txp
becomesmyform.txp
- make folders for each form type you’d like and drag the files into the respective folders
- mem_templates no longer exports sections properly, *see below for how to set that up
- ignore the plugins directory
- move those directories over to your rah_flat directory (I use /templates/import/
- you will no longer see the presentation tab or the four presentation sub pages
- the contents of your presentation directory’s files will be sucked into the database every time a file is altered and someone touches your site
- done
Moving back
- disable and/or delete rah_flat
- done
Sections
In case someone cajoles mem_templates into once again writing out sections, here’s what you used to have to do… Rename the section
forlder to sections
and split the nested json encoding from a singel file into multiple files named exactly for the sections…
*Sections should be set up thusly
Filename: my_section_name.json
{
"name": "my_section_name",
"page": "default",
"css": "default",
"in_rss": 1,
"on_frontpage": 0,
"searchable": 1,
"title": "My Section Title"
}
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
excellent! that info is very good to have
…. texted postive
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
Sorry, added step #4 which is important…
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
mrdale wrote #301195:
In case someone cajoles mem_templates into once again writing out sections…
Have you tried cxc-templates?
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files
NicolasGraph wrote #301137:
You’re right, that’s what I meant but you don’t need any form type in form file names at all now; the form type is defined by the subfolder where the form file is. See Structure in the help file or take a look at the templates folder example.
Jacob and Nicolas — thanks.
And Dale too, for that walk-through tute.
Offline