Topic on Extension talk:Chklist

Are other icons possible?

3
Fustbariclation (talkcontribs)

Is it possible to substitute another icon for [] and [x]?

I'd like to be able to have, for example, a tick and a cross, or a green button or a red one.

Kosibar (talkcontribs)

For my own personal use I've substituted the "create_list()" function with the following code to provide my own graphical checkboxes:

function create_list($input) {
    $i = 1;
    $temp = explode('[', $input);
    $str = "";
    while ($temp[$i] != NULL) {
        $content = explode(']', $temp[$i++]);
        switch(strtolower(substr($content[0], 0, 1))) {
            case "x": $check_type = "Checked"; break;
            case "-": $check_type = "Mixed"; break;
            default: $check_type = "Empty";
        }
        $str .= '<div class="chklist"><img src="'.$GLOBALS["wgScriptPath"].'/images/Checkbox-'.$check_type.'.png">'.$content[1].'</div>';
    }
    return $str;
}

Then I have three images in my "images" directory:

  • Checkbox-Checked.png
  • Checkbox-Empty.png
  • Checkbox-Mixed.png

A "mixed" checkbox is a box with a dash in it.

Fustbariclation (talkcontribs)

Thank you - that looks ideal - how do you call the function from the wiki?

Reply to "Are other icons possible?"