Added textarea with auto calc

This commit is contained in:
Deon George 2016-07-25 16:53:19 +10:00
parent 3bbab271e7
commit c5b2785e82

View File

@ -177,5 +177,16 @@ parserRules: {
public static function textarea_rows($textarea,$min=10,$char="\n") { public static function textarea_rows($textarea,$min=10,$char="\n") {
return ($x=count(explode($char,$textarea))) < $min ? $min : $x; return ($x=count(explode($char,$textarea))) < $min ? $min : $x;
} }
public static function textarea_width($textarea,$min=76,$char="\n") {
$x = $min;
foreach (explode($char,$textarea) as $string)
{
if (strlen($string) > $x)
$x = strlen($string);
}
return $x;
}
} }
?> ?>