Limiting output with substr?
Posted: Tue Feb 24, 2009 10:52 pm
With the following code, I want to limit the $title to 25 characters, with "..." after any that go over, for each link that is returned. What is the best way to go about it?
Code: Select all
foreach ($rss->items as $item ) {
if ($counter < 10) {
$title = $item[title];
$url = $item[link];
$counter++;
$cs = strpos($url, '/cs');
$tf2 = strpos($url, '/tf2');
$cod = strpos($url, '/cod');
$wow = strpos($url, '/wow');
$css = strpos($url, '/css');
if ($cs == true) {
?>
<tr>
<td width="25"><div align="right"><?
echo "<b>CS:</b><br>";?></td>
<?
?><td width="605"><?
echo "<a href=$url>$title</a></li><br>"; </td>