Textpattern CMS support forum

You are not logged in. Register | Login | Help

#141 2018-09-09 09:35:15

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,205
Website

Re: Testers needed: flat development (4.7+ only)

etc wrote #313933:

Hi Patrick, no offense intended, that just was the only plugin in Yiannis list that alters the page output, hence an easy suspect, sorry. Also, from what I’ve understood, you need to put it at the very beginning, so an eventual linebreak after it invalidates XML.

This makes me think that we should trim the final page output before serving it. I don’t see why anyone would need to start his pages with a space or a linebreak. Edit: done.

Sure ;)

Thanks lot for the commit: as always you make great things for TXP!


Patrick.
G+
Github | CodePen

Offline

#142 2018-10-08 15:45:39

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: Testers needed: flat development (4.7+ only)

Custom (flat) assets management is slowly taking shape in 4.7.2. One can edit and use site components (js, css etc) as forms, defining their mimetype via a pref (currently in Advanced options section). This custom_form_types pref (in ini format) allows also for custom form types definition. Example:

[js]
mimetype="application/javascript"
[shortcode]
*="Short code"
es="Etiqueta corta"

will add js and shortcode to available form types.

As a consequence, easter eggs plugin is not needed anymore for these tasks.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#143 2018-10-08 17:56:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

Re: Testers needed: flat development (4.7+ only)

etc wrote #314476:

… As a consequence, easter eggs plugin is not needed anymore for these tasks.

👍 Wonderful news!!! 👏


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#144 2018-10-09 15:14:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,458
Website

Re: Testers needed: flat development (4.7+ only)

etc wrote #314476:
[shortcode]
*="Short code"
es="Etiqueta corta"

I know the syntax has changed today but just on an i18n note, are we forcing people to specify language translations in this pref or can they be picked up via `gTxt()` somehow, perhaps via a well-known prefix? Just thinking it’d be easier for plugins/themes to add lang strings than cleanly merge their custom type definitions into the pref (unless there’s a companion API call to do it for them without duplicating existing mime types that may have been defined by hand?)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#145 2018-10-09 22:06:39

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: Testers needed: flat development (4.7+ only)

Bloke wrote #314499:

Just thinking it’d be easier for plugins/themes to add lang strings than cleanly merge their custom type definitions into the pref

I totally agree there should be a better way to manage strings, ideas welcome. But why a plugin/theme would add a custom type, which are intended only for easier classification? And custom mimetypes normally do not require translation…


etc_[ query | search | pagination | date | tree | cache ]

Offline

#146 2018-10-19 20:45:48

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,159
Website

Re: Testers needed: flat development (4.7+ only)

etc wrote #314476:

Custom (flat) assets management is slowly taking shape in 4.7.2. One can edit and use site components (js, css etc) as forms, defining their mimetype via a pref (currently in Advanced options section). This custom_form_types pref (in ini format) allows also for custom form types definition. … As a consequence, easter eggs plugin is not needed anymore for these tasks.

Just trying out 4.7.2 and I like what I see :-)

I’d just like to verify, we (currently) only see these new custom form types if we:

  • First, add the [formtype] to the list of allowed ‘custom_form_types’ pref in Admin › Preferences › Advanced Options (where necessary with mimetype details), AND
  • Create a forms/formtype folder in our theme saved on the server and put our form in it, AND
  • Avoid name clashes with other forms (regardless of form type) AND
  • Import the theme to the database

But we can choose any name we like (except for already reserved names).

Also, I already see the form types Category and Section. Are they new, or have I just never seen them in the past?


TXP Builders – finely-crafted code, design and txp

Offline

#147 2018-10-19 23:09:14

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: Testers needed: flat development (4.7+ only)

jakob wrote #314657:

we (currently) only see these new custom form types if we:

  • First, add the [formtype] to the list of allowed ‘custom_form_types’ pref in Admin › Preferences › Advanced Options (where necessary with mimetype details), AND
  • Create a forms/formtype folder in our theme saved on the server and put our form in it, AND
  • Avoid name clashes with other forms (regardless of form type) AND
  • Import the theme to the database

But we can choose any name we like (except for already reserved names).

Yes, though the last point is only needed when you develop “flat” forms (on the disk). The second and the third points work as before.

There are some subtleties when you export a MIME-typed form to the disk. Say, you have added js form type with application/javascript MIME type. Then you create two js-type forms: test.js and test_js and export them.

  • test.js will be saved as is, so you can access it as flat file.
  • test_js will be saved with .txp extension (test_js.txp) and forbidden for direct access via .htaccess.

Hence, you should save and serve static forms as flat files with extension, and those that contain txp tags without extension, to avoid exposing them to the world. <txp:output_form form="test.js" format="flat.url" /> and <txp:output_form form="test_js" format="url" /> provide their URLs.

Also, I already see the form types Category and Section. Are they new, or have I just never seen them in the past?

I don’t know when they have been introduced, must be 4.6.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#148 2018-10-20 06:37:56

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 172
Website

Re: Testers needed: flat development (4.7+ only)

forbidden for direct access via .htaccess

Modern HTTP servers, such as NginX, Hiawatha do not need .htaccess — is there some more generic, standards-compliant method?

Offline

#149 2018-10-20 09:37:05

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: Testers needed: flat development (4.7+ only)

Vienuolis wrote #314659:

Modern HTTP servers, such as NginX, Hiawatha do not need .htaccess — is there some more generic, standards-compliant method?

Servers configuration is not my cup of tea, NginX even less. I guess you’d need to forbid the direct access to .txp files, and Pete @gaekwad should know how :-)


etc_[ query | search | pagination | date | tree | cache ]

Offline

#150 2018-10-20 09:47:22

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 172
Website

Re: Testers needed: flat development (4.7+ only)

.htaccess rule conversion is not a big problem for me personally. I mean we should avoid dependence from Apache and other non-standard rules, at least in documentation.

Offline

Board footer

Powered by FluxBB