Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#961 2011-11-08 09:47:38

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

Re: glz_custom_fields

Thank you redbot. That’s very good to know.

Gerhard: Would it be possible for you to add an option when creating a new Text Area Custom Field to specify its text length? This would save me having to jump into PHPMyAdmin. I’m always afraid I’ll break something if I make a mistake while editing the tables.

Offline

#962 2011-11-08 12:05:30

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

Re: glz_custom_fields

I went into the Textpattern table to edit custom_10 which is the custom field I’m using for my text area. In PHPMyAdmin I changed the Type entry from VARCHAR to LONGTEXT and hit save. I then received the following error message which seems to be very similar to the error message I originally had when I created the text area using glz_custom_fields.

Error
SQL query: 
ALTER TABLE `textpattern` CHANGE `custom_10` `custom_10` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' 
MySQL said:  
#1101 - BLOB/TEXT column 'custom_10' can't have a default value

I also tried to change the value for custom_2 as redbot suggested and received the same error message.

Offline

#963 2011-11-08 12:11:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: glz_custom_fields

Algaris wrote:

  1. - 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

#964 2011-11-08 12:20:29

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

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.

Offline

#965 2011-11-08 13:40:19

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

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?

Offline

#966 2011-11-08 19:27:24

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

Re: glz_custom_fields

Install the bot_wtc plugin. It allows you to assign each custom field a CSS class.

Offline

#967 2011-12-08 21:03:03

Mats
Member
From: Sweden
Registered: 2011-01-16
Posts: 30
Website

Re: glz_custom_fields

Hi Gerhard

I donated earlier today, any chance you can send me the link to download?

Thanks,
Mats

Offline

#968 2012-01-24 06:42:51

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

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

#969 2012-01-24 06:55:16

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

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

#970 2012-01-24 09:18:32

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

Re: glz_custom_fields

Oh boy I completely forgot about the value="" check in the if_custom_field tag….!!

Offline

#971 2012-02-19 15:00:28

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

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

#972 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

Board footer

Powered by FluxBB