I am trying to get my site feed working.
I need to select some content and display in my feed. After selecting, i strip tags then display.
The problem is this:
The data still displays as if the tags still exist (but no visible html tag) eg. after stripping, in my source ill have:
Hello (just illustrating)
—-There will be gap in between as if html character still exist, but cant see any when i view my source—–
Hi
How can i fix this . Thanks
EDIT:
To make it clearer, after stripping i still get text like this:
This is my first line
This is my second line with a gap in between the first line and second line as if there is a paragraph tag
UPDATE
i am using this:
$body=substr(strip_tags(preg_replace(‘/\n{2,}/’,”\n”,$row[“post_content”])),0,150);
when i echo $body, it still maintains new lines
you may have a
\nwhich was at the end of the paragraphs after the closing tags you stripped.will strip out all
white space,tabs,new linesanddouble spacesand replace with single space.\sMatches any white-space character. Equivalent to the Unicode character categories[\f\n\r\t\v\x85\p{Z}]. If ECMAScript-compliant behavior is specified with the ECMAScript option,\sis equivalent to[ \f\n\r\t\v].