[Phplib-users] parser nl2br with tables
Brought to you by:
nhruby,
richardarcher
|
From: <so...@gm...> - 2002-09-19 08:34:08
|
hello list,
im searching for a parse who do this job:
parse nl2br into the content from the db.
but not in <table> tags. only in <td> tags
and outside of the table.
best regards,
MAREK.
i think it must be look like this...
but it's not so easy. (problem for example:
<table> can look sometimes: <table>
and <table cellspacing="0" cellpadding="0" border="0">
function parse_nl2br_table($parse_string) {
$pos_start = 0;
$pos_end = 0;
while ((strpos($parse_string, "<table>") != FALSE) ||
(substr($parse_string,0,7) == "<table>")) {
$pos_start = strpos($parse_string,"<table>");
$pos_end = strpos($parse_string,"</table>");
$out = substr($parse_string,$pos_start+7,$pos_end-8);
$out = $out;
$parse_string =
substr($parse_string,0,$pos_start).$out.substr($parse_string,
$pos_end+8,strlen($parse_string));
}
return $parse_string;
}
|