Welcome Guest, Not a member yet? Register   Sign In
call a model function in other file
#1

[eluser]Mitja[/eluser]
Why this is not working. I want to use it in view/admin/arrangement_edit.php

Code:
<tr>
<td>
Odhod:
<select name="departure_type">
&lt;?php echo $this->function_model->gkListArrayAsOptions($TransportTypesArray,  $row->departure_type); ?&gt;
</select>
</td>
</tr>

this is model/function_model.php file

Code:
class Function_model extends Model {

    function Function_model()
    {
        parent::Model();
    }
    
    function gkListArrayAsOptions($array, $selected=null)
    {
        $output = "";
    
        foreach($array as $value=>$text)
        {
            $selectAtt = "";
            if ($value == $selected) $selectAtt = "selected=\"selected\"";
            $output .= "<option value=\"$value\" $selectAtt>$text</option>";
        }
    
        return $output;
    }
}


Messages In This Thread
call a model function in other file - by El Forum - 05-27-2008, 04:23 PM
call a model function in other file - by El Forum - 05-27-2008, 04:55 PM
call a model function in other file - by El Forum - 05-27-2008, 10:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB