I need assistance with truncating text please
I found an earlier post with this
To have it not break in the middle of a word, I'd return more characters than you need in the sql query, maybe change it to 160... then add a function to the php:
php:
<?php
function truncate($str, $width) {
$str = str_replace("\n"," ",$str);
return strtok(wordwrap($str, $width, "...\n"), "\n");
}
?>
And then display the column using that function like:
php:
<?php echo(truncate($row_rsProductUpdates['summarytext'], 140)); ?>
But my attempt failed. I am adding my attempt in private message.