note 59305 deleted from function.constant by jacques
| From: | jacques@php.net | Date: | Fri, 02 Dec 2005 17:26:31 +0000 |
| Subject: | note 59305 deleted from function.constant by jacques | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99462@lists.php.net to get a copy of this message | ||
Note Submitter: p at script-tease dot net
----
If you have multiple classes doing the same thing, e.g. a directory listing, and want to make it
user-configurable, you can use constant() like so:
---------
<select name="x">
<?php
foreach ( $classes as $classname ) {
include_once('classes/directoryindex/'.$classname.'.php');
printf("<option value='%s'>%s</option>\n",
constant($classname.'::ID'),
constant($classname.'::Name')
);
}
?>
</select>
---------
then just add the consts "ID" and "Name" to each class.