|
Posted by comp.lang.php on 09/26/11 11:53
[PHP]
var $filterArray = array('reverse' => IMG_FILTER_NEGATE,
'edge highlight' => IMG_FILTER_EDGEDETECT,
'emboss' => IMG_FILTER_EMBOSS,
'gaussian blur' => IMG_FILTER_GAUSSIAN_BLUR,
'blur' => IMG_FILTER_SELECTIVE_BLUR,
'sketchy' => IMG_FILTER_MEAN_REMOVAL);
[/PHP]
I am trying to generate an HTML dropdown from this array, however, when
I do, the value that should go in the OPTION tag literally becomes
this:
[quote]
<option value="IMG_FILTER_EMBOSS">emboss</OPTION>
[/quote]
Which is completely wrong; I want the actual constant IMG_FILTER_EMBOSS
instead, which should display as an integer within the OPTION tag.
How do I do this?
Code:
[PHP]
/**
* Generate a filter technique dropdown HTML with any additional
features to the array before display
*
* *NOTE* This method will be called outside of the $this->image
property having existence and thus will have to be used as a
placeholder to self-instantiate using $this->self
*
* @access public
* @param array $newFilterArray (optional)
* @return mixed HTML
*/
function &generateFilterDropdown($newFilterArray = '') { // STATIC
HTML STRING METHOD
if (!is_object($this) || @!is_a($this,
'ImageFilterTechniqueGenerator')) {
$self =& new ImageFilterTechniqueGenerator('placeholder');
} else {
$self =& $this; // MAKE A LOCAL REFERENCE POINTER TO KEEP
CODE CONSISTENT
}
if (is_array($newFilterArray) && @sizeof($newFilterArray) > 0)
$self->setFilterArray($newFilterArray);
$filterArray = $self->getFilterArray();
if (is_array($filterArray) && @sizeof($filterArray) > 0) {
$html = "<select multiple name=\"filter_tech[]\" size=\"";
$html .= (sizeof($filterArray) > 5) ? 5 : sizeof($filterArray);
$html .= "\">\n";
foreach ($filterArray as $display => $filter) {
print_r("filter = $filter = ${$filter}<P>"); // THIS PRODUCES
"filter = IMG_FILTER_EMBOSS =
$html .= " <option value=\"${$filter}\"" .
$self->disp->preSelect(${$filter},
@array_search(array_values($filterArray), ${$filter})) . '>' .
str_replace('<', '<', str_replace('\\', '',
$display)) . "</option>\n";
}
$html .= "</select>\n";
}
return $html;
}
[/PHP]
Thanx
Phil
Navigation:
[Reply to this message]
|