cotonti.com : cot_extrafield_add radio https://www.cotonti.com Laatste forum onderwerpen Cotonti en Mon, 29 Dec 2025 07:24:56 -0000 esclkm /**
 * Add extra field for pages
 *
 * @param string $location Table for adding extrafield
 * @param string $name Field name (unique)
 * @param string $type Field type (input, textarea etc)
 * @param string $html HTML Resource string
 * @param string $variants Variants of values (for radiobuttons, selectors etc)
 * @param string $default Default value
 * @param bool $required Required field
 * @param string $parse Parsing Type (HTML, BBCodes)
 * @param string $description Description of field (optional, for admin)
 * @param string $params Params (for radiobuttons, selectors etc)
 * @param string $enabled Enable field
 * @param bool $noalter Do not ALTER the table, just register the extra field
 * @param string $customtype Modify sql type, size, default
 * @return bool
 *
 * @global CotDB $db
 */
function cot_extrafield_add($location, $name, $type, $html='', $variants='', $default='', $required=false, $parse='HTML', $description='', $params = '', $enabled = 1, $noalter = false, $customtype = '')
 

See please extrafields api.

Also for params you can use langfiles

$L['subs_1'];

]]>
Vr, 28 Dec 2012 07:04:27 -0000
Twiebie I'm trying to add an extrafield for a radio button with option 0 and 1. However I want the options named No, Yes, but 0,1 in the DB respectively.

I gave it a go with the following code, but I think I've missed something:

if ($db->query("SHOW COLUMNS FROM `$db_users` WHERE `Field` = 'user_subs'")->rowCount() == 0)
{
    cot_extrafield_add($db_users, 'subs', 'radio', '<label><input type="radio" name="{$name}" value="{$value}"{$checked} /> {$title}</label>', '0,1', '0',
        false, '', 'Subscribe', 'No,Yes');
}

It adds the extrafield without problems, but the values are not correct.

]]>
Thu, 27 Dec 2012 19:30:49 -0000