Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Use of CONSTANT to replace text values.

phpMyEdit Configuration     Use of CONSTANT to replace text values.
Odoslať novú tému   Odpovedať na tému    
 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-05-30 15:19
Návrat hore  Odpovedať s citátom     

Hey there. I make use of the define() command quite a bit across my sites and was wondering if there is a way to change the displayed output with the CONSTANTS already defined.

Kód:
define('MY_TABLE_CONSTANT', 'table name in database');
define('MY_VALUE_CONSTANT', 'show value text');
define('MY_NAME_CONSTANT', 'show name text');

$opts['fdd']['test_attempt'] =array(
'name' => MY_NAME_CONSTANT, // works fine
'select' => 'T',
'values' => array(
         'table' => MY_TABLE_CONSTANT, //works fine
         'column' => 'uid',
         'description' => 'subject' // the contents of this row contains 'MY_VALUE_CONSTANT' and I would like the 'description' to output 'show value text' instead of MY_VALUE_CONSTANT
),
'help'   => 'Some Help Text'
);


I was thinking I would have to hack the core class to use the
Kód:
if (defined($this->value)) ? constant($this->value) : $this->value;
command but thought maybe you all know of a better/other way that doesn't involve hacking the core class if possible.

Thanks.

 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-06-06 12:36
Návrat hore  Odpovedať s citátom     

Well in case anyone needed this ability as I did for <select> tags, here is the one line of code to add to your phpMyEdit.class.php file.

On my class file this is added in the function htmlSelect() at line 1583 :
Kód:
$value = (defined($value)) ? constant($value) : $value;


It comes before the $ret line so it looks liks this :
Kód:
line 1582: $escape  && $value = htmlspecialchars($value);
line 1583: $value = (defined($value)) ? constant($value) : $value;
line 1584: $ret .= '>'.$value.'</option>'."\n";


 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov