Hi, I've written the follwing custom template function to have the
possibility of making an easy select-box like {formSelect ('gender', '',
array('', 'male', 'female')}:

class MyClass implements ezcTemplateCustomFunction {
    public static function getCustomFunctionDefinition( $name ) {
        switch ($name ) {
            case "formSelect":
                $def = new ezcTemplateCustomFunctionDefinition;
                $def->class = "MyClass";
                $def->method = "formSelect";

                return $def;
        }
        return false;
    }

    public static function formSelect($selName, $selValue, $arrValues =
array(), $onChange = '') {
        $result = '';
        $result.= '<select name="' . $selName . '"';
        if($onChange != '') $result.= ' ' . $onChange;
                $result.= '>';
                foreach($arrValues as $key => $value) {
                                $result.= '<option value="' . $key . '"';
                                if($key == $value) $result.= '
selected="selected" ';
                                $result.= '>' . $value . '</option>';
                        }
              $result.= '</select>';
                return $result;
    }
}

My Problem is, when using this function, I need the raw output of this
function and I always get it with full html entities like '&lt;select
name=&quot;...' - ok I think I could use the function like {raw
(formSelect(...))} but I don not want to do this like that. Has anyone an
idea how to solve my problem?

Best regards, Peter


-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to