Folks,
Can any one who could hlp me plz....i got this script from this site : *labs.silverorange.com/archives/2004/june/smarttext but the codings are by array ...so i wanted something that could give from database . below is source code.
to have a full down load of the smart_trim : *labs.silverorange.com/images/smarttrim/smart_trim.zip
thanks
<?php
require('smart_trim.php');
$text=array();
$text[]='This is a test of a string with a lot of words that is to be trimmed at 20 characters';
$text[]='This is a test of a string with really-long-words-that-is-to-be-trimmed-at-20 characters';
$text[]=' This-is-a-test-of-a-string-that-contains-one-word-only-starting-with-whitespace';
$text[]='This-is-a-test-of-a-string-that-contains-one-word-only';
$text[]='This-is-a-test';
$text[]='!#$This is a test of a string with really-long-words-that-is-to-be-trimmed-at-20 characters ending-in-a-big-word';
$text[]='This-is-a-test-of-a-string-starting with a really long word end ending with regular sized words';
$length=20;
echo '<table cellspacing="0" border="1"><tr>';
echo '</tr>';
foreach($text as $string) {
echo '<tr>';
echo '<td>'.smart_trim($string,$length).'</td>';
echo '<td>'.smart_trim($string,$length,true).'</td>';
echo '</tr>';
}
echo '</table>';
?>
Can any one who could hlp me plz....i got this script from this site : *labs.silverorange.com/archives/2004/june/smarttext but the codings are by array ...so i wanted something that could give from database . below is source code.
to have a full down load of the smart_trim : *labs.silverorange.com/images/smarttrim/smart_trim.zip
thanks
<?php
require('smart_trim.php');
$text=array();
$text[]='This is a test of a string with a lot of words that is to be trimmed at 20 characters';
$text[]='This is a test of a string with really-long-words-that-is-to-be-trimmed-at-20 characters';
$text[]=' This-is-a-test-of-a-string-that-contains-one-word-only-starting-with-whitespace';
$text[]='This-is-a-test-of-a-string-that-contains-one-word-only';
$text[]='This-is-a-test';
$text[]='!#$This is a test of a string with really-long-words-that-is-to-be-trimmed-at-20 characters ending-in-a-big-word';
$text[]='This-is-a-test-of-a-string-starting with a really long word end ending with regular sized words';
$length=20;
echo '<table cellspacing="0" border="1"><tr>';
echo '</tr>';
foreach($text as $string) {
echo '<tr>';
echo '<td>'.smart_trim($string,$length).'</td>';
echo '<td>'.smart_trim($string,$length,true).'</td>';
echo '</tr>';
}
echo '</table>';
?>