Re: adding Plaintext to HTML::Form
| From: | Ted Shieh | Date: | Mon, 25 Feb 2002 09:33:10 +0000 |
| Subject: | Re: adding Plaintext to HTML::Form | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-4863@lists.php.net to get a copy of this message | ||
After Hakan Kuecuekyilma pointed out to me that addBlank() and addPlaintext() could be combined, I made some changes to addPlaintext(). The second argument to addPlaintext() is now optional. When it is left out, the function behaves similarly to addBlank() - it prints an , but differs in that it does not provide the option of printing multiple blanks (it has no equivalent of the first argument to addBlank(), $i). The new diff -u is shown below:
Ted Shieh
--- Form-old.php Wed Jan 30 04:26:26 2002
+++ Form-tedshieh.php Mon Feb 25 04:26:12 2002
@@ -17,7 +17,7 @@
// | Urs Gehrig <urs@circle.ch> |// +----------------------------------------------------------------------+ // -// $Id: Form.php,v 1.22 2002/01/30 09:26:25 ssb Exp $ +// $Id: Form.php,v 1.2 2002/02/14 01:30:57 Ted Shieh Exp $ // // HTML form utility functions. // @@ -178,6 +178,14 @@
}
// }}}
+ // {{{ addPlaintext()
+
+ function addPlaintext($title, $text = ' ')
+ {
+ $this->fields[] = array("plaintext", $title, $text);
+ }
+
+ // }}}
// {{{ start()
function start()@@ -468,6 +476,27 @@
}
// }}}
+ // {{{ displayPlaintext()
+
+ function displayPlaintext($text = ' ')
+ {
+ print $text;
+ }
+
+ // }}}
+ // {{{ displayPlaintextRow()
+
+ function displayPlaintextRow($title, $text = ' ')
+ {
+ print " <tr>\n";
+ print " <th align=\"right\" valign=\"top\">$title</th>";
+ print " <td>";
+ $this->displayPlaintext($text);
+ print "</td>\n";
+ print " </tr>\n";
+ }
+
+ // }}}
// {{{ returnText()
@@ -747,6 +776,29 @@
}
// }}}
+ // {{{ returnPlaintext()
+
+ function returnPlaintext($text = ' ')
+ {
+ return $text;
+ }
+
+ // }}}
+ // {{{ returnPlaintextRow()
+
+ function returnPlaintextRow($title, $text = ' ')
+ {
+ $str = " <tr>\n";
+ $str .= " <th align=\"right\">$title:</th>";
+ $str .= " <td>";
+ $str .= $this->returnPlaintext($text);
+ $str .= "</td>\n";
+ $str .= " </tr>\n";
+
+ return $str; + }+
+ // }}}
// {{{ display()
@@ -798,6 +850,10 @@
case "select":
$params = 8;
$defind = 4;
+ break;
+ case "plaintext":
+ $params = 2;
+ $defind = 1;
break;
default:
// unknown field type
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx