Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2016-12-05 13:27:31

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

Re: Comparisons in custom_field matching in article(_custom)?

etc wrote #303158:

Ok, I would then suggest that we consider month as starting point and enhance month and time with other human-readable (and PHP understandable) values like +3 weeks.

I like this. It should also be backwards compatible, because both month and time have been mutually exclusive so far.

For other custom fields we should take into the account the future (4.8?) unlimited cf, unless someone (not me) has already a clear idea of it.

I had a clear idea, once. It evaporated over six months of hacking core to get it to work. Now it’s more of a thought-slush. If the themes merge was tough, the custom-fields branch is going to break me!

The plan is that custom field names will no longer permit spaces. They’ll be “dumbed down” like we do with article titles so they can all be used as tag attributes in <txp:article_custom> and (hopefully) in tags for other content types. Use of custom_N will be supported but not encouraged. thisarticle is gonna be beefed up so that better l10n of strings is possible. I’d also like the cf names to be namespaced so they don’t clash with core globals.

Anything that relates to global attributes, etc will be supported by virtue of them being processed as regular tag attributes. Not sure how it affects this use case, but since each custom field has a type and one such type is ‘date’, well, we could conceivably use the same mechanism for such attributes.


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

#12 2016-12-05 15:11:23

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,400

Re: Comparisons in custom_field matching in article(_custom)?

Bloke wrote #303161:

The plan is that custom field names will no longer permit spaces.

Although it’s out of topic: In this case it would be helpful if the custom fields had names and titles, similar to the sections. The names for the intern parsing and the titles for the backend interface.

Offline

#13 2016-12-05 15:13:43

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

Re: Comparisons in custom_field matching in article(_custom)?

GugUser wrote #303171:

it would be helpful if the custom fields had names and titles, similar to the sections.

Nope. Names only. Titles are deferred to gTxt('my-custom-field-name') so they can be rendered in different languages, on both front- and admin-side.

Should be that way in the Sections panel, fwiw, but we have to live with it how it is.


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

#14 2016-12-05 15:29:46

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,400

Re: Comparisons in custom_field matching in article(_custom)?

Bloke wrote #303172:

Titles are deferred to gTxt('my-custom-field-name') so they can be rendered in different languages, on both front- and admin-side.

Have I lost the overview in the discussion? How would that work?

Offline

#15 2016-12-05 15:51:38

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

Re: Comparisons in custom_field matching in article(_custom)?

GugUser wrote #303174:

Have I lost the overview in the discussion?

I dunno. But it works that way on the admin side now. Try it out. Call one of your custom fields hr then visit the Write panel. You’ll see the custom field title horizontal rule. That’s gTxt() in action1.

If you add your custom field name to the txp_lang table it’ll use it (ymmv if you use spaces).

Currently you can’t output the custom field’s title on the public site because there’s no mechanism to do so. But in future, the <txp:custom_field> tag will have the ability to not only render the value of the custom field, but its meta data too (name, title, type, etc). If you elect to output its title, it will run the name through gTxt() and display it. Thus if you don’t have a translation it’ll show the custom-field-name instead.

The upshot is that you’ll be able to define a custom field called book-title and then define its name as:

  • Titre de livre (in fr)
  • Buchtitel (in de)

People with their admin side set to one of those two languages will see the appropriate label. If the public site is set to one of those languages you’ll be able to output the label in the public-side’s language too.

I haven’t figured out how best to administer this yet — probably as part of the multi-lingual stuff in future versions. The implementation I have right now has a Title field when you define a custom field but it stores it in the current language only. That needs fixing when I merge the latest codebase into the branch. Uhh, somehow.

Does that help?

1 Kudos to gaekwad for finding this: I never noticed until he pointed it out to me last month!

Last edited by Bloke (2016-12-05 16:08:06)


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

#16 2016-12-05 15:59:27

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,400

Re: Comparisons in custom_field matching in article(_custom)?

Bloke wrote #303175:

Does that help?

That seems to be good, even if I don’t yet understand it 100%. I will see it in the future…

Offline

#17 2016-12-06 16:02:31

etc
Developer
Registered: 2010-11-11
Posts: 3,360
Website

Re: Comparisons in custom_field matching in article(_custom)?

Bloke wrote #303161:

I like this. It should also be backwards compatible, because both month and time have been mutually exclusive so far.

I’ve tried to make it as bw compatible as possible, please test. Now we can output the upcoming articles with something like

<txp:article_custom month="now" time="+1 month" />

Anything that relates to global attributes, etc will be supported by virtue of them being processed as regular tag attributes. Not sure how it affects this use case, but since each custom field has a type and one such type is ‘date’, well, we could conceivably use the same mechanism for such attributes.

I guess it will be not before 4.8. And I would also consider a separator for custom fields that can carry multiple values (like Keywords, say).

Offline

Board footer

Powered by FluxBB