Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1129 2014-12-19 14:00:15
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: glz_custom_fields
I modified this plugin to handle labels and values for checkboxes.
Was a simple feature that it really needed.
At line 874. within the foreach loop, under the comment, I placed the following:
$label_value = explode('=', $value);
$label = $label_value[0];
$value = (array_key_exists(1, $label_value)) ? $label_value[1] : $label;
This will update the $value if it needs to, otherwise the default $value will still be used.
In your Custom Fields Editor, use this format:
label=value
blue=001
x-large=xl
large/x-large=l-xl
top choice=5
worst choice=1
This could probably set for radio buttons too.
Rich
Offline
#1130 2015-01-12 14:31:48
Re: glz_custom_fields
Hi gerhard, all,
I just started using this plugin for yet another non-profit project.
I’ll start with a very basic question.
Do you call the fields in the same way as you do the normal custom fields os is my code below correct?
<txp:article_custom section="artworks" category='<txp:category1 />' limit="100">
<txp:article_id />
<txp:glz_custom_fields name="year" default="-"/>
<txp:title />
<txp:glz_custom_fields name="type" default="-"/>
<txp:glz_custom_fields name="dimensions" default="-"/>
</txp:article_custom>
> Edited to add that I have tried using both the vanilla tag and the glz prefix but no output seems to be parsed. I have created a folder called plugins
in the root of the site and dropped the glz_custom_fields
folder inside it.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#1131 2015-01-12 14:36:00
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: glz_custom_fields
colak wrote #287292:
Do you call the fields in the same way as you do the normal custom fields
Yes. So your code for a cf would be <txp:custom_field name="type" default="-"/>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#1132 2015-01-12 15:00:09
Re: glz_custom_fields
thanks uli… I think that I just made them work:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#1133 2015-10-02 17:35:28
Re: glz_custom_fields
I have a problem with accented letters: for example, vidéo becomes vido (the é is dropped). I already tried to replace all occurrences of htmlspecialchars
with txpspecialchars
but the problem is still here and I can’t find the reason. Where should I look?
Last edited by CeBe (2015-10-02 17:35:44)
Offline
#1134 2015-10-02 18:58:10
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: glz_custom_fields
Hi Claire, if possible with the website you’re working on, try disabling glz_cf temporarily, then go to the advanced preferences, the cfs are now displayed there, again, enter the correct term, save and reactivate glz. I tried the Franco-Allemand mixture “Vidéogröße”. It’s accepted and displayed on the admin side. Haven’t tried, though, whether it works and whether each possibility to use it is viable, I’ve been a good guy ;) and only worked with ASCII until now.
If problems arise, there’s also wet_babble bot_cf_titles to individualize custom field names (thanks, GugUser).
Edit: Just tried to edit the Vidéogröße field I entered without glz_cf, but now with glz_cf re-activated and – of course – glz_cf swallows all flourishes. So either edit field names as a last step or use the wet plugin from the start.
Last edited by uli (2015-10-03 14:26:28)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#1135 2015-10-02 19:26:36
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: glz_custom_fields
I’ve found this here, might be more likely the thing you’re after, Claire:
// will leave only [A-Za-z0-9 ] in the string
function glz_clean_string($string) {
if ($string)
return preg_replace('/[^A-Za-z0-9\s\_\-]/', '', $string);
}
Edit: Yup, I just added ßöéà
to the regex and I could save “Vidéogröße” and “Voilà” :)
Last edited by uli (2015-10-02 19:34:04)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#1136 2015-10-02 20:24:51
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: glz_custom_fields
CeBe wrote #295341:
Where should I look?
I know, this is not an answer to your question, but I can confirm that I frequently use the glz custom fields for Spanish text parts like, for example, “González Suárez y Av. Oswaldo Guayasamín”, and never had any problems with it.
Letters like these are shown correctly: ñøÁèô.
Your problem is not a general problem. I know, this doesn’t help.
Maybe this:
Do you use Typekit with a disabled french language subsetting, or fonts without the required characters?
Offline
#1137 2015-10-02 20:27:58
Re: glz_custom_fields
uli wrote #295342:
try disabling glz_cf temporarily, then go to the advanced preferences, the cfs are now displayed there, again, enter the correct term, save and reactivate glz.
Woah!!! It works!
Note: this has to be done every time such a custom field is edited.
uli wrote #295345:
I’ve found this here, might be more likely the thing you’re after, Claire:
// will leave only [A-Za-z0-9 ] in the string...
Yup. Would be cleaner with a regexp to keep accents too.
A really big big thank you!
Offline
#1138 2015-10-02 20:28:16
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: glz_custom_fields
Other idea: I beginn my .htaccess file with AddDefaultCharset utf-8
.
Offline
#1139 2015-10-02 20:38:03
Re: glz_custom_fields
GugUser wrote #295348:
I frequently use the glz custom fields for Spanish text parts
Ok, I asked my question too rapidly, I’m sorry .
The accents were not kept for the names of the custom fields in admin side. The content is correct.
Offline
#1140 2015-10-02 20:53:28
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: glz_custom_fields
Oh, but that’s another thing.
I quote from the documentation:
Important notes on creating custom field names:
Custom field names may include letters (uppercase or lowercase), numbers, and under scores, but no spaces or other special characters should be used. For example, custom1, Custom1, and Custom_1 are all valid name constructs, while custom 1 and custom ! are not.
Offline