I would actually do it like this:
First add this function at the top of your page:
<?php
// CUTTEXT
function cutText($string, $length) {
if($length<strlen($string)){
while ($string{$length} != " ") {
$length--;
}
return substr($string, 0, $length);
}else return $string;
}
?>
Then, where your content is:
<?php
include('cms102/WA_CMS/addtosite.php');
$content = (WA_getCMSContent($database_localhost, $localhost, 'index.php' , 'content');
$content = strip_tags($content, '<p><a>');
$content = cutText($content, 150);
echo $content;
?>
Now, I know this looks like a bit more code, but it will be better in the end because you will use the Strip Tags function to strip out any html tags - such as image tags or other tags that will actually eat up character length. The other problem if you don't strip tags is what happens when your substring ends in the middle of an open html tag such as an image.
In the example I provided, you'll notice after the strip tags command in the parenthesis, I have "<p><a>" as the second attribute. This means that all html tags EXCEPT the p and a tags will get stripped. I usually do this to leave the paragraphs and links in tact while getting rid of images and all other stuff for preview purposes.
After I strip the tags, I then call the custom Cut Text function to trim it down to what I want.
Regards,
Brian