Codice PHP:
<?php

/*
* DOCMan 1.3.0 for Mambo 4.5.1 CMS  
* @version $Id: mod_docman_lister.php,v 1.3 2005/08/09 02:40:00 johanjanssens Exp $
* @package DOCMan_1.3.0
* @copyright (C) 2003 - 2005 The DOCMan Development Team
* @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL
* Official website: [url]http://www.mambodocman.com/[/url]
*/

// you can define the following parameters at administration:

// show_icon = displays a generic icon near the name of the document, using the theme defined (default = 1) No=0; Yes=1
// show_counter = displays the number of downloads (default = 1) No=0; Yes=1
// show_category = display the category name after the document name (default = 1) No=0; Yes=1
// link_type = the type of link to display (default = 0) List=0; Search=1; Details=2; Direct=3
// moduleclass_sfx = module class suffix (default='')
// show_list = show results using <ul> tag (default = 0) No=0; Yes=1
// text_pfx = text to show before list (default='')
// text_sfx = text to show after list (default='')
// limits = number of downloads to display (default = '') 
// cat_limit = search a specific category ( or list ) if provided (default='')
// itid = override the passed itemid and use this one, if present (default='')
// order_by = how to order the results (default = 0) Most hits=0; Least hits=1; Newest=2;
//            oldest=3; Alphabet=4; Alphabet, reverse=5

// Internal revision 1 - 27 march 2005
// Internal revision 2 - 27 march 2005 - fixed bugs
// Internal revision 3 - 27 march 2005 - added moduleclass_sfx and cache, output fix
// Internal revision 4 - 27 march 2005 - added text prefix and suffix
// Internal revision 5 - 27 march 2005 - cosmetic fixes
// Internal revision 6 - 17 april 2005 - moved language strings, made compatible with 1.3 RC 1
// Internal revision 7 - 08 aug   2005 - made compatible with 1.3 RC 2

// TODO - Ben Jones 2005
// Seperators/titles on admin parameters section would be nice
// CSS classes should be merged with main DOCMan ones? maybe not?
// Make admin help button work

// Check we're called from the right place
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// Include the DOCMan class
include_once( $mosConfig_absolute_path."/administrator/components/com_docman/docman.class.php");

//DOCMan core interaction API
global $_DOCMAN;
if(!
is_object($_DOCMAN)) {
    
$_DOCMAN = new dmMainFrame();
}

$_DOCMAN->setType(_DM_TYPE_MODULE);
$_DOCMAN->loadLanguage('modules');

// Include some other DOCMan classes
require_once($_DOCMAN->getPath('classes''utils'));
require_once(
$_DOCMAN->getPath('classes''file'));
require_once(
$_DOCMAN->getPath('classes''model'));

// get the parameters
$show_icon          abs($params->def'show_icon'));
$show_counter     abs($params->def'show_counter'));
$show_category      abs($params->def'show_category'));
$link_type        abs($params->def'link_type'));
$moduleclass_sfx $params->get'moduleclass_sfx' );
$show_list        abs($params->def'show_list'));
$text_pfx          $params->def'text_pfx''' );
$text_sfx          $params->def'text_sfx''' );
$limits           $params->def'limits''' );
$cat_limit          $params->def'cat_limit''' );
$itid               $params->def'itid''' );
$order_by        abs($params->def'order_by'));

$menuid $_DOCMAN->getMenuId();
$user   $_DOCMAN->getUser(); 

// Some strings
$string_icon_alt "File icon";
$class_link     "mod_docman_lister_link" $moduleclass_sfx;
$class_prefix     "mod_docman_lister_prefix" $moduleclass_sfx;
$class_suffix     "mod_docman_lister_suffix" $moduleclass_sfx;

// Setup some variables
$content "";

// Sort out the ordering
switch ( $order_by ) {
    case 
0:
        
// Most hits
        
$order "hits";
        
$dir   "DESC";
        break;   
    case 
1:
        
// Least hits
        
$order "hits";
        
$dir   "ASC";
        break;   
    case 
2:
        
// Newest
        
$order "date";
        
$dir   "DESC";
        break;   
    case 
3:
        
// Oldest
        
$order "date";
        
$dir   "ASC";
        break;   
    case 
4:
        
// Alphabetically
        
$order "name";
        
$dir   "ASC";
        break;   
    case 
5:
        
// Alphabetically, reverse
        
$order "name";
        
$dir   "DESC";
        break;   
}

$rows DOCMAN_Docs::getDocsByUserAccess($cat_limit$order$dir$limits); 

// If we have a textual prefix, show it now
if ( strlen($text_pfx) > ) {
    
$content .= "<span class='$class_prefix'>" $text_pfx "</span>
"
;   
}

// List output
if ( $show_list == ) {
    
$content .= "<ul>";   
}

// For each row of our result..
foreach ($rows as $row) {
    
    
// List output
    
if ( $show_list == ) {
        
$content .= "[*]";   
    }

    
// Create a new document
    
$doc = new DOCMAN_Document($row->id);
    
    
// Create the appropriate type of link
    
$linkText "";
    switch (
$link_type) {
        case 
0:
            
$linkText "index.php?option=com_docman&task=cat_view&amp;Itemid=$menuid&amp;gid=".$row->catid."&amp;orderby=dmdatecounter&ascdesc=DESC";
            break;
        case 
1:
            
$linkText "index.php?option=com_docman&amp;task=search_result&amp;Itemid=$menuid&amp;search_phrase=" urlencode($row->dmname) . "&amp;search_mode=phrase";
            break;
        case 
2:
            
$linkText "index.php?option=com_docman&amp;task=doc_details&amp;Itemid=$menuid&amp;gid=" $row->id;
            break;
        case 
3:
            
$linkText "index.php?option=com_docman&amp;Itemid=$menuid&amp;task=doc_download" $itid "&amp;gid=" $row->id;
            break;   
    }
    
$url sefRelToAbs$linkText );
    
$content .= "<a class=\"$class_link\" href=\"$url\">";
   
    
// If we are showing the icon, do it
    
if ($show_icon) {
        
$content .= "<img border='0' src=\"".$doc->getPath('icon'1'16x16')."\" alt=\""_DML_FILEICON_ALT ."\" /> ";
    }
    
    
// Output the document name
   
$content .= $doc->getData('dmname');



     


    
// If we are showing the counter or the category, do it
    
if ($show_counter) {
        
$content .= " (".$doc->getData('dmcounter').")";
    }
    if (
$show_category) {
        
$content .= "
("
.$row->cat_title.")";
    }
        
    
// Add the end link and break
    
$content .= "</a>";

    
// List output
    
if ( $show_list == ) {
        
$content .= "";   
    } else {
        
$content .= "
"
;
    }

}

// If we had 0 results.. 
if ( count($rows) == ) {
    
// List output
    
if ( $show_list == ) {
        
$content .= "[*]";   
    }
    
    
$content .= _DML_MOD_NODOCUMENTS ;

    
// List output
    
if ( $show_list == ) {
        
$content .= "";   
    }
}

// List output
if ( $show_list == ) {
    
$content .= "[/list]" ;   
}

// If we have a textual suffix, show it now
if ( strlen($text_sfx) > ) {
    
$content .= "<span class='$class_suffix'>" $text_sfx "</span>
"
;   
}

?>

E' uno script di un modulo di Joomla che serve per mostrare gli ultimi downloads. A me interessa che il nome del file , se più lungo di circa 27 caratteri, venga troncato a tre caratteri prima dei 27 ed aggiunti... ( in modo che non venga scritto su due righe...)

Questa porzione stampa il nome:

// Output the document name

$content .= $doc->getData('dmname');


Grazie mille!!!