Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 09:33 am EST

Geeklog Forums

Feature Request: COM_optionList


Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Here's the proposed change. Make $LangTable a parameter to COM_optionList:
Text Formatted Code
function COM_optionList( $table, $selection, $selected='', $sortcol=1, $where='', $LangTable = null)
{
    global $_DB_table_prefix;

    $retval = '';

    if (!isset($LangTable)) {
        if( substr( $table, 0, strlen( $_DB_table_prefix )) == $_DB_table_prefix ) {
            $LangTableName = 'LANG_' . substr( $table, strlen( $_DB_table_prefix ));
        } else {
            $LangTableName = 'LANG_' . $table;
        }
        global $$LangTableName;

        if( isset( $$LangTableName )) {
            $LangTable = $$LangTableName;
        } else {
            $LangTable = array();
        }
    }
//etc

Reason: To not have so many itty-bitty tables with 2 options:
Text Formatted Code
$LANG_LETTERS_OPTIONS = Array(0 => 'A', 1 => 'B');
$LANG_EVER_OPTIONS = Array(0 => 'Never', 1 => 'Always');

Currently you'd have to have two tables gl_letters_options and gl_ever_options. This way you could have a single table:
Text Formatted Code
CREATE TABLE {$_TABLES['options']} (
  code varchar(10) not null,
  value vachar(200) not null,
  option_type varchar(20) not null,
  index(opt_num, code)
);

and populate it:
{'0', 'A', 'letters'}
{'1', 'B', 'letters'}
{'0', 'Never', 'ever'}
{'1', 'Always', 'ever'}

and call it:
Text Formatted Code
COM_optionList($_TABLES['options'], 'code,value', $selected, 1, "option_type = 'letters'", $LANG_LETTERS_OPTIONS);
COM_optionList($_TABLES['options'], 'code,value', $selected, 1, "option_type = 'ever'", $LANG_EVER_OPTIONS);



 Quote

All times are EST. The time is now 09:33 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content