La version française est disponible ici : pxLastResDescription2
In order to add this function, you need to create:
- in manager/tools a folder named
myfunctions
- in manager/tools/mesfonctions a file named
register.php
NB : the
register.php file must start with a:
<?php
and end with a:
?>
Add the following code inside
register.php:
function pxLastResDescription2
($s=
'%s',
$limit=
0,
$return=
false)
{
$result =
'';
if ($limit) {
$text = text::
truncate(text::
parseContent($GLOBALS['_PX_render']['last']->
f('description'),
'text'),
$limit);
$result =
sprintf($s,
$text);
} else {
$result = text::
parseContent($GLOBALS['_PX_render']['last']->
f('description'));
}
if ($return) return $result;
echo $result;
}
The function can then be used in the template
resource_article.php with:
<?php pxLastResDescription2('%s', 100); ?>
NB : in this example, only the first 100 characters will be displayed