Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1189 2017-07-30 15:42:05

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: glz_custom_fields

I recently installed the plugin and now I want to use the new custom field in php script. Currently I intend to do it via hidden fields of the form in the article. The form calls the script.

For standard custom fields we just name the custom field like so: <input type=“hidden” name=“zaloha” value=<txp:custom_field name=“Záloha” />>

But when I enter the name of the glz custom field it seems tha value is empty. How am I supposed to acces the glz custom field from code? (Btw. the field is a textarea multiline string.)

Last edited by david@druna.cz (2017-07-30 15:44:56)

Offline

#1190 2017-07-30 23:48:48

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,644
Website

Re: glz_custom_fields

david@druna.cz wrote #306492:

For standard custom fields we just name the custom field like so: <input type=“hidden” name=“zaloha” value=<txp:custom_field name=“Záloha” />>

But when I enter the name of the glz custom field it seems tha value is empty. How am I supposed to acces the glz custom field from code? (Btw. the field is a textarea multiline string.)

I am not sure your custom field name can contain characters like á. Perhaps that is the issue?


Where is that emoji for a solar powered submarine when you need it ?

Offline

#1191 2017-07-31 03:04:32

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,926
Website

Re: glz_custom_fields

phiw13 wrote #306493:

I am not sure your custom field name can contain characters like á. Perhaps that is the issue?

why cant custom fields have utf8 characters? big oversight if they are not allowed


…. texted postive

Offline

#1192 2017-07-31 03:47:17

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,644
Website

Re: glz_custom_fields

bici wrote #306494:

why cant custom fields have utf8 characters? big oversight if they are not allowed

I don’t know… another weirdness with this plugin? When I tested, creating a custom field with the plugin, name: tést, the name was truncated to tst after saving. It does work for standard (the 10 provided but Textpattern) custom fields.

EDIT
Or maybe that part is something wrong on my install? I see the custom_fields table has latin1 set for name and value. Puzzled, as this TXP4.6 was definitely created with the charset set to UT8-mb4.


Anyway, I also wanted to note, I created a textarea custom field (test_textarea), and could verify that with the code provided by David, it does work.

<input type="hidden" name="foo" value="<txp:custom_field name='test_textarea' />">

Last edited by phiw13 (2017-07-31 09:15:15)


Where is that emoji for a solar powered submarine when you need it ?

Offline

#1193 2017-07-31 16:39:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

Re: glz_custom_fields

david@druna.cz wrote #306492:

I want to use the new custom field in php script.

Is that script stored in a Textpattern form? If not: try it from there. I’ve no experience with such sripts in TXP, maybe you’d need to wrap it in a pair of <txp:php> tags. EDIT: There are admin settings that allow/disallow the use of PHP in several places. Check whether they‘re set accordingly.

In case the accented letter is part of the problem and you want the client to see proper spelling: There’s a plugin, bot_cf_titles, that lets you replace custom field names on the surface while the actual field name can remain without accent for the proper functionality of TXP and plugins involved.


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

Offline

#1194 2017-08-01 05:41:46

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,469

Re: glz_custom_fields

I can not figure it out what’s the problem with glz_custom_fields, radio or checkbox after an upgrade from Textpattern 4.5.7 to 4.6.2 (it’s not the first time I did that ;-) ):

“Ooops! custom_2 has some problems. Go fix it.”

But I can’t fix anything.

If I change to input type all is fine.

Any idea? Thanks.

Offline

#1195 2017-08-01 13:29:19

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

Re: glz_custom_fields

Simply to spur some thoughts:
Is the plugin the most recent one?
Are there any errors, maybe hidden by the current production state (backend/frontend)?
Does glz_cf throw that message if it’s the only active plugin?
Could it be caused by the name of the field?
Or by any contents/special characters in that/these field(s)? (Also: too much content in there?)


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

Offline

#1196 2017-08-01 15:06:50

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,469

Re: glz_custom_fields

Hi uli, thanks for your answer.

uli wrote #306508:

Is the plugin the most recent one?

Yes.

Are there any errors, maybe hidden by the current production state (backend/frontend)?

Notice "A non well formed numeric value encountered"
in /home/www/web111/html/la-lengua/textpattern/include/txp_prefs.php at line 819.
textpattern/include/txp_prefs.php:819 adminErrorHandler()
textpattern/include/txp_prefs.php:90 real_max_upload_size()
textpattern/include/txp_prefs.php:49 prefs_save()
textpattern/index.php:211 include()
Notice "A non well formed numeric value encountered"
in /home/www/web111/html/la-lengua/textpattern/include/txp_prefs.php at line 819.
textpattern/include/txp_prefs.php:819 adminErrorHandler()
textpattern/include/txp_prefs.php:90 real_max_upload_size()
textpattern/include/txp_prefs.php:49 prefs_save()
textpattern/index.php:211 include()

Does glz_cf throw that message if it’s the only active plugin?

Yes.

Could it be caused by the name of the field?

No, the names are “Ancho” and “Zoom”, the same like in other installations without problems.

Or by any contents/special characters in that/these field(s)? (Also: too much content in there?)

Are checkboxes.

Offline

#1197 2017-08-01 16:42:36

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

Re: glz_custom_fields

Sorry, no ideas.

In order to speed things up: The function in txp_prefs is the following one, the line with case 'm': $val *= 1024;

function real_max_upload_size($user_max)
{
    // The minimum of the candidates, is the real max. possible size
    $candidates = array($user_max,
                        ini_get('post_max_size'),
                        ini_get('upload_max_filesize'), );
    $real_max = null;
    foreach ($candidates as $item) {
        $val = trim($item);
        $modifier = strtolower(substr($val, -1));
        switch ($modifier) {
            // The 'G' modifier is available since PHP 5.1.0
            case 'g':
                $val *= 1024;
            case 'm':
                $val *= 1024;
            case 'k':
                $val *= 1024;
        }
        if ($val > 1) {
            if (is_null($real_max)) {
                $real_max = $val;
            } elseif ($val < $real_max) {
                $real_max = $val;
            }
        }
    }

    return $real_max;
}

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

Offline

#1198 2017-09-29 02:07:52

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: glz_custom_fields

I have found out that glz_custom_fields is applying textile to my custom textarea field. Is there a way to stop this? Textile has been turned off for the said article. (Nonetheless I would like to stop the textile even if it was turned on for the article.)

Offline

#1199 2017-09-29 04:59:36

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,644
Website

Re: glz_custom_fields

david@druna.cz wrote #307253:

I have found out that glz_custom_fields is applying textile to my custom textarea field. Is there a way to stop this? Textile has been turned off for the said article. (Nonetheless I would like to stop the textile even if it was turned on for the article.)

Start your blocks with notextile. ? Hmm not necessarily user friendly…

Maybe there is a plugin that can prevent Textile to work, such as “smd_wrap”?


Where is that emoji for a solar powered submarine when you need it ?

Offline

#1200 2017-09-29 12:06:21

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: glz_custom_fields

I found out notextile. inside a custom textarea does not get interpreted and acts like a plain text. Actually textile might not be the issue I’m having. The text from the custom field just gets wierdly encoded/padded when I get it from php.

Not sure if I can post links to other questions here but here my main question greatly involving glz_custom_fields. Any help would be greatly appreciated. https://forum.textpattern.com/viewtopic.php?pid=307250#p307250

phiw13 wrote #307254:

Start your blocks with notextile. ? Hmm not necessarily user friendly…

Maybe there is a plugin that can prevent Textile to work, such as “smd_wrap”?

p.

Offline

Board footer

Powered by FluxBB