Wiki Plume Community : pxLastResDescription2English

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
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
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.0549 seconds