2012-08-31, 16:13:58
mikeh Wrote:focoves Wrote:problem with SPECIAL CHARACTERS into excerpt
special characters are well showed in full articule, but excerpt show a bad decode
look here:
http://decorametacrilato.es/dev/novedades/
Version 1.0.2 Added To Extend:
- Re-worked $Blog->create_excerpt() method to deal with special characters.
File changes described below:
Before
Code:public function create_excerpt($content, $start, $maxchars)
{
$content = substr($content, $start, $maxchars);
$pos = strrpos($content, " ");
if ($pos>0)
{
$content = substr($content, $start, $pos);
}
$content = html_entity_decode(strip_tags(strip_decode($content)));
$content = str_replace("Read The Full", "", $content);
return $content;
}
After
Code:public function create_excerpt($content, $start, $maxchars)
{
$content = substr($content, $start, $maxchars);
$pos = strrpos($content, " ");
if ($pos>0)
{
$content = substr($content, $start, $pos);
}
$content = htmlspecialchars_decode(strip_tags(strip_decode($content)));
$content = str_replace(i18n_r(BLOGFILE.'/READ_FULL_ARTICLE'), "", $content);
return $content;
}
Note this change should also be noted in the "Click here for tips and tricks for custom blog pages" section.
Currently it lists "Decode Content: <?php echo html_entity_decode($post->content); ?>"
When it should now be this: "Decode Content: <?php echo htmlspecialchars_decode($post->content); ?>"
This concern was also noted in one of my earlier posts. Its nice to see it has been changed, but the documentation should also be updated.