Show N characters from pages in your category listings
|
|
If you want to display extracts from pages in your category listings (news-like "Read More" layout), this tiny plug-in will help you with {LIST_ROW_EXTRACT} tag for list.tpl.
Installation:
Changelog:
As one flexible function:
Installation:
1. Unpack the files to your 'plugins' directory.
2. Go to admin panel and install the plugin.
3. Configure number of characters to show in extracts.
4. Edit your 'skins/skin_name/list.tpl' and add {LIST_ROW_EXTRACT} in LIST_ROW section.
Changelog:
0.2:
* New auto-closing model as described in this article
* Fixed HTML mode parsing.
As one flexible function:
PHP Code:
// Cutpost
function sed_cutpost($text, $max_chars, $parse_bbcodes = true)
{
$text = $max_chars == 0 ? $text : sed_cutstring(strip_tags($text), $max_chars);
// Fix partial cuttoff
$text = preg_replace('#\[[^\]]*?$#', '...', $text);
// Parse the BB-codes or skip them
if($parse_bbcodes)
{
// Parse it
$text = sed_parse($text);
}
else $text = preg_replace('#\[[^\]]+?\]#', '', $text);
return $text;
}
function sed_cutpost($text, $max_chars, $parse_bbcodes = true)
{
$text = $max_chars == 0 ? $text : sed_cutstring(strip_tags($text), $max_chars);
// Fix partial cuttoff
$text = preg_replace('#\[[^\]]*?$#', '...', $text);
// Parse the BB-codes or skip them
if($parse_bbcodes)
{
// Parse it
$text = sed_parse($text);
}
else $text = preg_replace('#\[[^\]]+?\]#', '', $text);
return $text;
}
Download : Extracts from Pages 0.2 
Size: 1KB, downloaded 199 times

Size: 1KB, downloaded 199 times


























