PHP Classes

File: plugins/truncate/plugin.php

Recommend this page to a friend!
  Classes of P. Krijnberg   Expose template engine   plugins/truncate/plugin.php   Download  
File: plugins/truncate/plugin.php
Role: Auxiliary script
Content type: text/plain
Description: Truncate plugin
Class: Expose template engine
Template compiler engine extensible with plug-ins
Author: By
Last change: role
Date: 18 years ago
Size: 438 bytes
 

Contents

Class file image Download
<?php
function expose_plugin_truncate( & $expose, $params )
{
   
$params = exposeMergeParameters( $params, array(
       
'text' => '',
       
'length' => 80,
       
'trail' => '...'
   
) );
   
    if(
strlen( $params['text'] ) > $params['length'] ) {
        return
substr( $params['text'], 0, $params['length'] )
            .
$params['trail'];
    } else {
        return
$params['text'];
    }
}
?>