Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#949 2011-11-08 12:11:42
Re: glz_custom_fields
Algaris wrote:
- - BLOB/TEXT column ‘custom_10’ can’t have a default value
You need to remove the DEFAULT ''
from the end of the query to get rid of the error. So if you have a default value set for that column in phpMyAdmin, clear it before saving the changes.
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
#950 2011-11-08 12:20:29
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 570
Re: glz_custom_fields
Thank you Bloke. The Dafault entry was set to As defined
from its drop down. When I changed it to None
everything worked.
I guess this means for each custom text field I have on the Write tab I’ll have to edit its entry in PHPMyAdmin.
Online
#951 2011-11-08 13:40:19
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 570
Re: glz_custom_fields
One more quick question. If I wanted to style a custom field I’ve created with glz_custom _fields (such as increasing its width and height) is there an easy way to do so with CSS?
Online
#952 2011-11-08 19:27:24
Re: glz_custom_fields
Install the bot_wtc plugin. It allows you to assign each custom field a CSS class.
Offline
#953 2011-12-08 21:03:03
Re: glz_custom_fields
Hi Gerhard
I donated earlier today, any chance you can send me the link to download?
Thanks,
Mats
Offline
#954 2012-01-24 06:42:51
Re: glz_custom_fields
Been looking through this thread to find out how to find the value of a select type of custom field – say for example we have select options One, Two and Three within a custom field named Content_type
.
How to display content if the value ==Three? Something like this:
<txp:if_custom_field name="Content_type{Three}">
<div class="image"><txp:body /></div>
</txp:if_custom_field>
Offline
#955 2012-01-24 06:55:16
Re: glz_custom_fields
<txp:if_custom_field name="Content_type" value="Three">
<div class="image"><txp:body /></div>
</txp:if_custom_field>
I can’t remember using the select field for something right now, but I think this is how the if_custom_field tag works.
Offline
#956 2012-01-24 09:18:32
Re: glz_custom_fields
Oh boy I completely forgot about the value=""
check in the if_custom_field
tag….!!
Offline
#957 2012-02-19 15:00:28
Re: glz_custom_fields
Just a suggestion for an improvement:
Although you can override the default install directory (/plugins
) for certain glz_custom_fields files (I use /textpattern/glz_custom_fields
as I like to keep things out of the root directory as much as possible) the plugin still looks for some of it’s files within the default /plugins
folder.
Need a way to override that really, at the moment I have to manually edit the plugin code to point to my preferred directory.
Cheers,
Phil
Last edited by philwareham (2012-02-19 15:01:03)
Offline
#958 2012-03-13 16:38:14
- frickinmuck
- Member
- Registered: 2008-05-01
- Posts: 118
Re: glz_custom_fields
I’m using this custom script to input categories as options on a select menu. How do I change it to a multi-select?
<?php
function list_clients($custom_field, $custom_id, $custom_value) {
$categories = array();
$query = safe_rows('name, title', 'txp_category', 'parent like "client"');
foreach ($query as $category)
$categories[$category['title']] = $category['title'];
return glz_selectInput($custom_field, $custom_id, $categories, $custom_value, "");
}
?>
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#959 2012-03-14 05:34:44
Re: glz_custom_fields
wow – I’ve amazed myself (nearly, sort of)
I can’t get your example to work, but using the my_images.php, I added a, “1” after the default value – as this changes it from a select to a multi select from what I can gather from the code.
This was the original my_images.php code:
return glz_selectInput($custom_field, $custom_id, $images, $custom_value, "2");
and I changed it to this – and now its a multiselect
return glz_selectInput($custom_field, $custom_id, $images, $custom_value, "2", "1");
Hope that helps… but its probably worth getting this checked
Offline
#960 2012-03-14 15:33:59
Re: glz_custom_fields
frickinmuck wrote:
I’m using this custom script to input categories as options on a select menu. How do I change it to a multi-select?
<?php
function list_clients($custom_field, $custom_id, $custom_value) {
$categories = array();
$query = safe_rows('name, title', 'txp_category', 'parent like "client"');
foreach ($query as $category)
$categories[$category['title']] = $category['title'];
return glz_selectInput($custom_field, $custom_id, $categories, $custom_value, "");
}
?>
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[] = ' ';
foreach ($query as $title)
$titles[$title['name']] = $title['title'];
return glz_selectInput($custom_field, $custom_id, $titles, $custom_value, "1", true);
}
?>
Offline