Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-09-16 14:45:13

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

glz_custom_fields

##################################################################
This version of the plugin is outdated!
For more current versions (plural) please see the links in this topic’s first post.
##################################################################

glz_custom_fields, unlimited custom fields

This plugin used to be paid-for, but is now free (and GPL3).

The latest version is v1.4.0-beta1, which is reported to work on the 4.5 TXP branch.

To install, unarchive the downloaded zip file, open the glz_custom_fields-1.4.0-beta1 file in your text/code editor (yes, it’s missing the txt extension – sorry!), copy and paste that file as you would any TXP plugin.

This plugin sits under the Extensions tab in the back-end and gives your custom fields new life. You can finally have custom fields that are selects, multi-selects, checkboxes, radios and textareas – besides the default input fields. You can predefine values for custom fields and you can select a single default value (selects, multi-selects, checkboxes and radios only). Rather then constantly typing in the same thing over and over again, just select or check it and you’re set.

The plugin doesn’t require any hacking of TXP, it’s a straight install with instant gratification. Also there’s support for special custom fields as well.





Last edited by uli (2018-05-01 20:20:27)

Offline

#2 2007-09-16 15:05:24

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: glz_custom_fields

colak wrote:

Hi gerhard can you please clarify what you mean when you say “unless you have left the custom fields as they were”.

OK, imagine custom_1_set is of type text input and you change it to select (or anything else) and then pre-define some values for it. If after this you try to edit an article which has for custom_1 a value which is not among the predefined ones, the value won’t be selected – and you won’t be able to select it – and thus when hitting save, the article’s custom_1 value will become blank.

The plugin won’t delete any values automatically. However, I see your point and that’s why the question you have raised will be addressed in v1.0 (check the new features list).

redbot wrote:

I’m missing: the possibility to set a default value for custom fields.

Excellent call mate, this will also be present in v1.0.

Offline

#3 2007-09-16 15:21:12

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: glz_custom_fields

Hi Gerhard,

Thanks for opening a new thread for this excellent plugin. What I miss so far is some examples of how to use the plugin – I think there is only one example in the help – are there any more examples available?

Offline

#4 2007-09-16 18:04:12

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: glz_custom_fields

jstubbs, most of the plugin is meant for the back-end, there are only 2 front-end functions so far – the ones documented in the help. All of the custom fields specific functions which come with TXP will work as expected. The only grey area is when one wants to use the custom fields above 10. There is one crucial function within TXP which imposes a hard limit on the custom fields, getCustomFields() in publish.php. A lot of other functions use it, so I would basically have to slightly modify all of them – which is a pig as you might imagine. Ideally, the core developers will be sympathetic enough towards this plugin to make the 2 line modification to getCustomFields() that will sort out this mess. I will make another mod request on the dev list shortly, just giving people enough time to try the plugin out and see whether they are willing to implement the change.

So, to wrap it up, use the same functions that you would for normal custom fields on the front-end and get back if something doesn’t work as expected. Hope that answers your question.

Offline

#5 2007-09-16 19:58:18

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: glz_custom_fields

hey hey. before i drop a donation, i was wondering if the plugin is capable of this:
(might be too unorthodox for most. im not sure):

say i wanted a dropdown box for a custom field. would there be a way to grab image category names and automatically pull them in as values to choose from? (whether via some dirty hack or some php magic to slap into the “values” area. as long as it works.).

im asking because i’m currently using rss_thumbpop for a site and the way its set up, the user has to manually type an image category name into a custom field, and then the plugin takes that image category name to output a specific gallery for that article.

Offline

#6 2007-09-16 20:17:42

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: glz_custom_fields

Yup, this is a great plugin, covering a functionality we’ve waited for several long years. Well done Gerhard!

I can provide a French translation, no problem.

As for suggestions: what about the capability to have unique or multiple choices, but the option of entering a free one?

Example: let’s say we have a License custom field. There are several default value: LGPL, Art Libre, various Creative Commons, etc. Then, I publish some data copyrighted by, Zem for example (with permission of course). The article’s custom field offer me to pick one choice among the various default license, but here I need to enter a new one: “The first part is LGPL, the second part is ©2007 Alex Shields, used with permission”.

To do that, I can right now create a radio-custom-field with the defaults, add a “special” default choice, and a second custom field that will be used only if the “special” radio box is checked. A little complex to set up and use, but more important it’s less user friendly.

Another suggestion: local, context, explanations (micro documentation). From the user point of view, maybe he has a Help button for each custom field, or an overlay that appear when he select this specific custom field area. Of course, the webmaster would have to write the micro-documentation (probably at the same stage as setting up the custom field and choices themselves).

Another one: what about using this for keywords? In a multiple-authors website, it’s easy to misspell keywords. If I write a Texpattern article on a blog, what’s his keyword: textpattern, Textpattern, TXP? And there’s the possibility of typos. So when the article’s keywords area is selected, the user would have an (alphabetically sorted) overlay of existing keyword. He can click to the ones he wants, or add his new ones (that will be displayed for the next use of this functionality).

Last suggestion (for now :-p): the ability to create new choices (default data) for custom field (when appropriate). A little like the last suggestion, but this time for custom field. The user can select among many options (choices) written by the webmaster, but he can also create new ones for that custom field, and use them.

Offline

#7 2007-09-17 00:26:20

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: glz_custom_fields

Gerhard,
I have a problem with the <txp:glz_custom_fields_article /> tag.
When the search should give no results all articles are listed instead.
It happens either when one clicks “submit” without specifing a value and when values are specified but no articles matching are found.
In all other cases it works properly.
I don’t know if this is caused by something I did wrong or is a bug.
Ah …thanks for including default values in the next version ;-)

Offline

#8 2007-09-17 06:20:33

ooz
Member
From: Finland
Registered: 2007-07-27
Posts: 14

Re: glz_custom_fields

iblastoff wrote:

[…] would there be a way to grab image category names and automatically pull them in as values to choose from?[…]

This is also what I have in mind. I’m already pleased with the semi-automatic version that this plug-in provides, since the values for a select are behind administrator-rights and provide a solution against spelling-mistakes as well as pre-defined values for the authors.

I will definitely participate in this request somehow. And it should be taken on step further…

Jeremie wrote:

As for suggestions: what about the capability to have unique or multiple choices, but the option of entering a free one?

If this is not already done good enough in the plug-in admin table, tags for retrieving and updating an options-list would be a start. If this list can be linked to say image- categories by yet another tag, then I would call it mission accomplished.

A good example for this scenario would be a list of locations for reoccuring events or a list of teachers in a school. People come and go and the contents of a corresponding select could be updated automatically from a separate list that links to whatever (for example articles in the section “teachers” or “locations”).

iblastoff wrote:
[…] the user has to manually type an image category name into a custom field, and then the plugin takes that image category name to output a specific gallery for that article.

This is a good example for the need to link the contents of a drop-down to e.g. an image-subcategory list.

Last edited by ooz (2007-09-17 06:23:15)


“Habit is probably the greatest obstacle of perceiving truth.” R.A. Schwaller de Lubitz

Offline

#9 2007-09-17 09:12:55

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: glz_custom_fields

iblastoff wrote:

say i wanted a dropdown box for a custom field. would there be a way to grab image category names and automatically pull them in as values to choose from? (whether via some dirty hack or some php magic to slap into the “values” area. as long as it works.).

I think you are hinting here at trigger words, same thing as with ranges. This is very interesting from a programming point of view, it got me all excited : ). It’s definitely doable and has already been included on the new features list. The functionality that you are talking about here will be known as |Image Categories| (so that we know it’s a trigger expression).

Jeremie wrote:

I can provide a French translation, no problem.

Great! Let me know if there is anything you need to get started on this!

what about the capability to have unique or multiple choices, but the option of entering a free one? & the ability to create new choices (default data) for custom field

Yes, definite yes! At the bottoom of the select/checkbox/radio there will be another input field for specifying new values. However, this will enable users to insert values in the default lists, the admins will have to check them every now and then for consistency. I’ll have a function in place that will check and remove duplicates but that’s about as much as I can do.

local, context, explanations (micro documentation)

Excellent idea! From what I can tell so far, this plugin is set to grow and, after a while, documentation will become more and more necessary. Consider it a feature for v2.0.

redbot wrote:

When the search should give no results all articles are listed instead. It happens either when one clicks “submit” without specifing a value and when values are specified but no articles matching are found.

When no value is specified, it’s normal that the search returns all results because you aren’t constraining them in any way. When no articles are matched though, the <glz_custom_fields_article /> will re-direct to no_results section though (as you could see in the screencast). Is this not working for you?

ooz wrote:

A good example for this scenario would be a list of locations for reoccuring events or a list of teachers in a school. People come and go and the contents of a corresponding select could be updated automatically from a separate list that links to whatever (for example articles in the section “teachers” or “locations”).

Yes, trigger words. I could think of the following trigger words so far:

  • |Image Categories|
  • |File Categories|
  • |Article Categories| (will include the nice tree view that is available under Category tab)
  • |Schools Category Article| (will return a list of all article titles belonging to “schools” category)
  • |Holiday Category Image| (will return a list of all image names belonging to “holiday” category)
  • |Portfolio Category File| (will return a list of all file names belonging to “portfolio” category)
  • |Listings Section| (listings is the section name here and it will return all article titles belonging to that section)

Ok, that’s what I could think of so far, any more suggestions, just submit them.

Work is calling, hope all of you are having fun this week ; ).

Last edited by gerhard (2007-09-17 09:14:36)

Offline

#10 2007-09-17 09:54:05

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: glz_custom_fields

gerhard wrote:
When no value is specified, it’s normal that the search returns all results because you aren’t constraining them in any way. When no articles are matched though, the <glz_custom_fields_article /> will re-direct to no_results section though (as you could see in the screencast). Is this not working for you?

Ok Gerhard you’re right, I was trying to get this to work in a wrong way…
and yes, when no value is specified it’s normal that the search returns all results
everything works fine now
thanks

Last edited by redbot (2007-09-17 10:10:29)

Offline

#11 2007-09-17 10:42:30

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: glz_custom_fields

gerhard wrote:

I think you are hinting here at trigger words, same thing as with ranges. This is very interesting from a programming point of view, it got me all excited : ). It’s definitely doable and has already been included on the new features list. The functionality that you are talking about here will be known as |Image Categories| (so that we know it’s a trigger expression).

this sounds excellent! my donation has been sent :) in the meantime i’m going to think about what other tasty treats could be thrown into the mix.

Offline

#12 2007-09-17 10:52:27

kevinmcdougall
Member
Registered: 2007-02-08
Posts: 55

Re: glz_custom_fields

Brilliant Gerhard! Thanks for developing this. There’s a million and one ways I can imagine this being useful.

I had managed to cobble together a way of doing this using new functions in txp_article.php, and mod the database to make custom fields searchable, but it was never, ever going to be as slick as this!

Expect a tenner from me soon.

PS. recently put together a list/review of my top ten TXP plugins, now I have to start again from scratch!

Last edited by kevinmcdougall (2007-09-17 11:02:03)

Offline

Board footer

Powered by FluxBB