pike.git / lib / modules / String.pmod / HTML.pmod

version» Context lines:

pike.git/lib/modules/String.pmod/HTML.pmod:19:   //! The value that should be selected by default, if any.   //!   //! @example   //! select("language",   //! ({ ({ "eng", "English" }),   //! ({ "swe", "Swedish" }),   //! ({ "nor", "Norwegian" }) }),   //! "swe");   string select(string name, array(string)|array(array(string)) choices,    void|string selected) { -  string ret = "<select name=\"" + name + "\">\n"; +  .Buffer ret = .Buffer(); +  ret->add("<select name=\"", name, "\">\n");       if(sizeof(choices) && arrayp(choices[0])) {    foreach([array(array(string))]choices, array(string) value) -  ret += "<option value=\"" + value[0] + "\"" + -  (value[0]==selected?" selected=\"selected\"":"") + -  ">" + value[1] + "</option>\n"; +  ret->add("<option value=\"", value[0], "\"", +  (value[0]==selected?" selected=\"selected\"":""), +  ">", value[1], "</option>\n");    } else {    foreach([array(string)]choices, string value) -  ret += "<option value=\"" + value + "\"" + -  (value==selected?" selected=\"selected\"":"") + -  ">" + value + "</option>\n"; +  ret->add("<option value=\"", value, "\"", +  (value==selected?" selected=\"selected\"":""), +  ">", value, "</option>\n");    }    -  return ret + "</select>"; +  ret->add("</select>"); +  return (string)ret;   }      //! This function should solve most of the obox needs that arises. It   //! creates a table out of the array of arrays of strings fed into it.   //! The tables will (with default settings) have a thin black outline   //! around the table and between its cells. Much effort has gone into   //! finding a simple HTML reresentation of such obox that is rendered   //! in a similar way in all popular browsers. The current   //! implementation has been tested against IE, Netscape, Mozilla,   //! Opera and Konquest.
pike.git/lib/modules/String.pmod/HTML.pmod:252:    }       //! It is possible to case this object to a string, which does the same    //! as calling @[render], and to an array, which returns the cells in an    //! array of rows.    mixed cast(string to) {    if(to=="array")    return rows;    if(to=="string")    return render(); -  error("Could not cast OBox object to %s.\n", to); +  return UNDEFINED;    }   }