Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-09-29 02:58:11

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

esq_glzcfvallist - Output all values of a glz_custom_field

esq_glzcfvallist

Output all values of a glz_custom_field

Textpattern 4.2.0+ recommended, glz_custom_fields required.

Download here.
Current version: 1.03, updated 2010-10-03.

  1. Install and activate the plugin
  2. Add a bit of <txp:esq_glzcfvallist fieldname="MyCustomFieldName" [delimiter="," ]/> to your Pages, Forms or Articles
  3. Sprinkle generous amounts of rah_repeat is so desired

The delimiter attribute is optional, and defaults to a comma if omitted.

This is a quick and dirty plugin to output all values for select, multi-select, radio or checkbox custom fields created using glz_custom_fields. This was just going to be an internal plugin, but hopefully others may find it helpful.

Please provide feedback if you have any – especially if you encounter any errors.

Last edited by radneck (2015-11-04 20:49:06)

Offline

#2 2011-02-16 15:46:19

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: esq_glzcfvallist - Output all values of a glz_custom_field

This would be so valuable, but in my experience it fails to catch the values from text-input custom fields. This is because the custom_field table isn’t updated when you save articles, I suppose. Reading your post, I guess this is known and intended (you only mentioned select, multi-select, rado or checkbox fields). Is there any way or an easy routine to have also the text-input fields?

Offline

#3 2011-02-17 02:37:55

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_glzcfvallist - Output all values of a glz_custom_field

Hi Maurizio,

Can you explain in a little more detail what you would like to achieve?
I think I know what you mean, but not 100% sure.

Offline

#4 2011-02-17 10:55:28

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: esq_glzcfvallist - Output all values of a glz_custom_field

Hi Mitch. I tried to use your plugin to have a list of values used in custom fields whose type is “text field”. It failed. I tried to look at your plugin’ source, and seen it catches the values used in custom fields from custom_field table (used by gerhard’s plugin). I’ve looked at my custom_field table, and seen it was empty. All my custom field were “text field”. After some trial and error, I set another custom field of type “checkbox”, with two values and saw that custom_field table were not empty anymore. So I guess that:

  1. your plugin only catch values from that table, and
  2. that the table is filled only for custom field types different from “text” and “textarea”

Am I wrong?

I think this is because custom_field table is filled only on custom field creation, not on article saving. So that table can’t list all values used in articles for text and textarea custom fields.

Actually, I’ve managed to have that list using an article_custom cycle, but I think from performance pov this is far from optimal, expecially when you have a lot of articles. I was wondering if there could be a better way. Maybe using a plugin that fill a custom table on article saving, to extract that list easily when you need it.

I hope I’ve better explained the issue, feel free to ask if not.

Offline

#5 2011-02-17 12:19:32

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: esq_glzcfvallist - Output all values of a glz_custom_field

The plugin is designed to pull the possible values for the custom field types where you are limited in what you can choose. Because text fields are not limited in this way, they are not stored in the same table (as you noted). The best thing to do is probably grab a copy of smd_query and pull together a SQL statement that will pull all the values used for the text custom field in question from each article.

If you’re having trouble doing this let me know where you get stuck and I’ll do my best to help.

Last edited by radneck (2014-03-04 04:21:22)

Offline

#6 2011-02-17 12:48:00

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: esq_glzcfvallist - Output all values of a glz_custom_field

Thanks. Well, actually I’ve managed to do this with article_custom. Don’t know if smd_query could be a quicker way to go. I’ll give it a look. I was thinking that saving the different values of custom text fields in a specific table on article saving (checking for duplicates) could be faster than any other method: when you need all values, you simply pull them out from that table, without cycling from an indefinite number of articles (in my scenario I use text field for storing years, venues and clients: there are few of them, even with dozens of articles; this method could pay off in my scenario, not sure about a different one).

Thanks for clarifications.

Offline

Board footer

Powered by FluxBB