Replace the outputbody.php file with this version:
Code:
<?php
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com
//For syntax pf bpdu, see: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/
//Function by default defines 3 different body outputs (templates). Modify or add additional templates as desired
function shortencontent($content, $len=30){
if(strlen($content) > $len){
return substr($content, 0, $len - 6) . ' . . .';
} else {
return $content;
}
}
function outputbody($item, $template=""){
if ($template=="" || $template=="default"){ //DEFAULT TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></div>
<div class="rssdate"><?php echo $item->get_date('d M Y g:i a'); ?></div>
<div class="rssdescription"><?php echo shortencontent($item->get_description()); ?></div>
</DIV>
<?php
} //end default template
else if ($template=="titles"){ //"TITLES" TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>" target="_new"><?php echo $item->get_title(); ?></a></div>
<div>Category: <?php echo $item->get_category(); ?></div>
</DIV>
<?php
} //end titles template
else if ($template=="titlesdates"){ //"TITLESDATES" TEMPLATE
?>
<DIV class="rsscontainer">
<span class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span>
<span class="rssdate"><?php echo $item->get_date('m/d/y g:i a'); ?></span>
</DIV>
<?php
} //end titlesdates template
else if ($template=="mytemplatename"){ //"mytemplatename" TEMPLATE
?>
//DEFINE ADDITIONAL CUSTOM TEMPLATE(s) USING SAME LOGIC STRUCTURE AS ABOVE
//For syntax of template body, see SimplePie docs: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/
<?php
}
else
die ("No template exists with such name!");
} //Closing function bracket
?>
Notice the red 30 near the beginning. It determines the maximum length for the content, the description in this case. All descriptions longer than that will have their last 6 characters up to 30 replaced with:
and the rest dropped. Obviously 30 characters are probably too short, so adjust that red number as desired. It will be the maximum length including the padding dots of any description. Any description shorter or equal to this number in length will appear in its entirety without the padding dots.
Notes:
I also took the liberty of replacing all shorthand <? tokens with the more formal <?php one. This will have no bearing on the functionality. It simply brings outputbody.php into line with the other PHP scripts used by RSS Box and will avoid errors on systems that don't accept the shortcut token.
If you want to use the shortencontent function for other stuff in outputbody.php, but with a different length, specify that length in the call, example:
Code:
<?php echo shortencontent($item->get_title(), 15); ?>
Bookmarks