You are correct moshu. I just read that on the wordpress codex wiki.
Anyway, I got some type of solution for extracting the first ‘n’ lines of a post.
$MAX_CHARS=200;
$MAX_LINES=3;
$c=0; //loop counter
$output=”; //trimmed content
//get the excerpt/content
ob_start();
the_excerpt();
$tmp = ob_get_contents();
ob_end_clean();
//process the string
$tmp = substr($tmp,0,$MAX_CHARS);
$lines = explode(“\n”,$tmp);
foreach($lines as $line) {
if($c==$MAX_LINES) break;
$output .= $line;
$c++;
}
echo $output;
The only thing I couldn’t figure out how to do was append “…” to the end, so you’d have something like; “This is a very long string which…”
The function “the_excerpt()” returns the html and I’m not sure how to go about finding the last html tag, then inserting “…” before the tag. Of course you have to watch out for <br />
too. If that exists prior to the last tag, it needs removal or “…” will be on the next line.
Anyway, maybe someone will find the code useful.