Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,438
Website

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
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
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: 1,438
Website

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
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
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: Miami, Florida
Registered: 2005-11-29
Posts: 2,634
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
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,173
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.


The text persuades, the *notes prove。

Offline

#37 2016-09-07 19:21:29

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

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

hcgtv wrote #301201:

Have you tried cxc-templates?

Yeah, looks like it would only require a small mod to make the sections output json… I kinda prefer mem_templates which is a fork of cxc. But they’re both useful.

Offline

#38 2016-09-07 20:02:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,390
Website

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

My updated version of the exporter does export section.json files.


TXP Builders – finely-crafted code, design and txp

Offline

#39 2016-09-07 20:42:56

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

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

jakob wrote #301208:

My updated version of the exporter does export section.json files.

Oh! delightful… thanks

[Edit]

Man, if you wanted to be insanely heroic, you could put forms into subfolders named by type.

[Edit]

Wish I knew how to contribute to your github repo… just updated so that you can set an empty value for form naming scheme and it’ll omit the “type” in names on export.

} else if ($this->_config['form_naming_scheme'] == 'type_name'){
    $file_name = (isset($row['type']) ? ".".$row['type'] : "") . $row['name'];
} else {
    $file_name = $row['name'];
}

So now you really would just have to figure out how to do subfolders by form type.

Offline

#40 2016-12-20 10:48:32

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,173
Website

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

jakob wrote #301208:

My updated version of the exporter does export section.json files.

I’m going to use this, when I get to that point.

Btw, in the ReadMe file, first section, the “oui_flat” link should be https://github.com/NicolasGraph/rah_flat, though I like your name better for the distinction.


The text persuades, the *notes prove。

Offline

Board footer

Powered by FluxBB