Textpattern Forum

You are not logged in. Register | Login | Help

#1101 2013-11-04 12:01:30

Karsten
Member
Registered: 2011-04-24
Posts: 19

Re: glz_custom_fields

Quick question, I’m currently using version 1.3.0. Could someone tell me how to update the plugin? Simply install the newest version, or should I fist un-install the existing version? I don’t want to mess up my site as it is dependant on those customfields already working in version 1.3.0

thanks

Offline

#1102 2013-11-04 23:02:34

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 814
Website

Re: glz_custom_fields

From the Read me file found in the download link glz custom fields page 1:

This version of the plugin is for Textpattern 4.4.x,
it will most probably not work properly on previous versions.

  1. BACKUP YOUR DATABASE

This is not optional. The plugin won’t delete anything automatically,
but if something goes wrong, you might end up losing all your custom fields data.
  1. PLUGINS FOLDER Place the `glz_custom_fields` folder from the archive into your website’s
    plugins folder. You should end up with something similar to: |— HISTORY.txt |— README.txt |— index.php |— ……….. |— plugins | `— glz_custom_fields <<< THIS IS THE FOLDER THAT YOU NEED TO ADD |— ……….. `— textpattern |— checksums.txt |— config-dist.php |………………
  2. INSTALL PLUGIN
    Now delete your existing `glz_custom_fields` plugin, and install the
    version included in this folder. That’s it!
  1. [Issues]::: [Tips] ::: [Github]

Offline

#1103 2013-11-25 01:41:11

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 362

Re: glz_custom_fields

mrdale dijo:

This is my script to grab all categories that have parent “XXX” and make a multi-select custom field out of them

<?php
function my_parents_cats($custom_field, $custom_id, $custom_value) {
  $titles = array();
  $query = safe_rows('name, title', 'txp_category', "parent like 'XXX' AND type like 'article'");
  $titles[] = '&nbsp;';
  foreach ($query as $title) 
    $titles[$title['name']] = $title['title'];
  return glz_selectInput($custom_field, $custom_id, $titles, $custom_value, "1", true);
}
?>

This code was very useful for me, but I’d want to know how to use checkboxes instead of use multi-select dropdown list.
Anybody does know?
Thanks in advanced

Offline

#1104 2013-11-25 12:35:55

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,084

Re: glz_custom_fields

Fernando, in the above code, try removing
return glz_selectInput($custom_field, $custom_id, $titles, $custom_value, "1", true);
and replace with
return glz_checkbox($custom_field, $titles, $custom_value, "1", true);

This is in no way tested, just an attempt based on logic comparing two lines from glz’s my_images.php (No. 39 + 43) and Dale’s last line.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1105 2013-11-25 12:59:08

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 362

Re: glz_custom_fields

Thanks Uli. Yes, it works!
Best regards

Last edited by gfdesign (2013-11-25 16:22:49)

Offline

#1106 2013-11-25 16:59:52

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,084

Re: glz_custom_fields

You’ve removed the question. Whas it actually the query? I couldn’t see the reason for the empty line but would be interested in case you could solve it code-sided.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1107 2013-11-25 17:19:28

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 362

Re: glz_custom_fields

Hi Uli.
I found the problem. My code was:

<?php
function lista_secciones_revista($custom_field, $custom_id, $custom_value) {
  $titles = array();
  $query = safe_rows('name, title', 'txp_category', "parent like 'notas' AND type like 'article' AND name!='root' ORDER BY name");
  $titles[] = '&nbsp;';
  foreach ($query as $title) 
  $titles[$title['name']] = $title['title'];
  return glz_checkbox($custom_field, $titles, $custom_value, "1", true);  
}
?>

I removed this line:

$titles[] = '&nbsp;';

and the extra checkbox was gone. Very simple, but my knowledge as designer didn’t let me see the issue in the code I got.
Thanks for your intersting.
Regards

Offline

#1108 2014-04-22 15:27:23

jordi
Member
From: Barcelona
Registered: 2005-09-14
Posts: 86
Website

Re: glz_custom_fields

I have a custom field that I use to store embed codes from ivoox, youtube, and such. The code is stored all right in the database, but when I call it on the frontend all the html special chars are replaced by entities, so it does not work. Is there a workaround for this?

By the way, I am using the plugin code from the first post (v1.4.0-beta1).

Thanks for the attention.

Offline

#1109 2014-04-22 15:44:11

photonomad
Member
Registered: 2005-09-10
Posts: 258
Website

Re: glz_custom_fields

@jordi:

Add escape="" to your txp:custom_field tag and it should output the code as is.

Offline

#1110 2014-04-22 16:25:37

jordi
Member
From: Barcelona
Registered: 2005-09-14
Posts: 86
Website

Re: glz_custom_fields

Right, that did it. Thank you very much.

edit: and congrats for your awesome photos.

Last edited by jordi (2014-04-22 16:31:13)

Offline

Board footer

Powered by FluxBB