Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2016-08-31 13:06:13

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#26 2016-08-31 15:55:32

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

#27 2016-09-02 07:20:08

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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!


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#28 2016-09-07 06:11:35

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

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

#29 2016-09-07 06:33:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

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

#30 2016-09-07 08:40:07

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#31 2016-09-07 16:37:23

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

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

#32 2016-09-07 16:44:49

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

  1. run mem_templates on your current install
  2. locate the pages, sections, styes, and forms directories it created
  3. in your forms directory remove the form type from the name for all forms… ie myform.misc.txp becomes myform.txp
  4. make folders for each form type you’d like and drag the files into the respective folders
  5. mem_templates no longer exports sections properly, *see below for how to set that up
  6. ignore the plugins directory
  7. move those directories over to your rah_flat directory (I use /templates/import/
  8. you will no longer see the presentation tab or the four presentation sub pages
  9. 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
  10. done

Moving back

  1. disable and/or delete rah_flat
  2. 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

#33 2016-09-07 16:47:40

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files

excellent! that info is very good to have


…. texted postive

Offline

#34 2016-09-07 16:54:56

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: oui_flat (rah_flat fork) - Manage templates and prefs as flat files

Sorry, added step #4 which is important…

Offline

#35 2016-09-07 17:00:03

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

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?

Offline

#36 2016-09-07 17:59:36

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

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

Board footer

Powered by FluxBB