Go to main content

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: 2,254
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,254
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
Archived 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,912
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

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

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

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: 5,199
Website GitHub

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

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
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
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.

Offline

#41 2016-12-20 15:08:18

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

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

@Jakob,

I always forget if these are anything to worry about, but in test or debug mode I get this after installing your plugin, jcr_export_txp_templates:

A problem occurred while loading the plugin: jcr_export_txp_templates -> 8192: Methods with the same name as their class will not be constructors in a future version of PHP; jcr_export_txp_template has a deprecated constructor on line 113

textpattern/lib/txplib_misc.php:1782 eval()
textpattern/index.php:193 load_plugins()

I’ll press on with it and see what happens.

UPDATE:

Exported! I first tried by editing the form naming type, type_name, as the docs mention is possible, but it didn’t output any form templates. I switched it back to the default, name_type, and tried again and it worked fine. I can work with that, but just to let you know what I witnessed there.

Last edited by Destry (2016-12-20 15:21:35)

Offline

#42 2016-12-20 18:28:01

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

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

Just need one clarification, anybody…

Nicolas’ plugin docs describe setting up the Forms folders using the form labels as provided by Txp. But Dale’s tutorial from earlier, notably step 4, makes it sound like you can use whatever folder names you want so long as they are under the parent “forms” folder that the rah_flat plugin reads from. So, is Dale right?

I could have, for example, my rah_flat root directory as…

../flat_parts

Then child folders like this, for example…

  • articles
  • forms
    • article_magic
    • content_components
    • metadata
    • modules
    • static_content
    • template_parts
  • misc

Instead of this…

  • forms
    • article
    • comment
    • links
    • miscellaneous
    • file
    • section

Yes? No?

I’m guessing that maybe you can’t do it that way because if you ever wanted to remove the plugin, or need to turn it off for any reason, then Txp wouldn’t know what to do with the forms if inside child folders not named with default names. Oi?

Last edited by Destry (2016-12-20 19:44:55)

Offline

#43 2016-12-20 18:50:31

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

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

@destry I hope you get it working. And can use your editorial skills to document the process. I have failed twice to make use of this plugin.

i am dying to have it as easy as what Mountee does with Expression Engine and flat files..


…. texted postive

Offline

#44 2016-12-20 19:55:25

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

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

Hmm… maybe answering my own Q, I just noticed in Nic’s docs, where it talks about structure, there is a “Custom” folder under the parent “Forms” folder, so maybe the intention is you need to use the stock folders (article, comment, links, etc), plus whatever additional custom folders you want.

I’ll try that, with the assumption you can edit it again later. O_O

Offline

#45 2016-12-21 08:00:30

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; in my version of rah_flat, forms are stored in the forms folder, and then, in subfolders by form types. For these subfolders you can use native and/or custom form types as names.
If rah_flat is disabled, forms using custom types are altered to use misc because Textpattern does not accept custom types for now (it shows an alert).
‘hope that helps ; I didn’t use jcr_export_txp_templates yet.

Last edited by NicolasGraph (2016-12-21 08:34:01)


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

Offline

Board footer

Powered by FluxBB