I have a function to clean up my html when using templates.
Works perfect except when i have a textarea that has a load of line breaks in it and it adds 8 or so tabs in after each line break.PHP Code:function indent($text,$n){
if(is_string($text) && is_int($n)){
$indent = "";
$i = 0;
while($i < $n){
$i++;
$indent.= "\t";
}
return str_replace("\n", "\n".$indent, str_replace(array("\r\n","\r"), "\n", $text));
}
}
I'm really bad with this kinda of thing, is there any way someone could help me with a regex to stop it doing that to anything between "[no-indent]" and "[/no-indent]" ?
Thanks !





Bookmarks