Ciao a tutti, vi sottopongo un piccolo problema nella speranza di riuscire a risolverlo.
Nel mio template ho caricato il modulo in oggetto perchè, per ragioni sconosciute, quello più nuovo (DGM NEWS ULTRA Lite Plus 2.0) con maggiori funzionalità, non funziona a dovere con joomla 1.0.12.
La versione 1.0, per quello che devo fare, mi va benissimo, ma vorrei avere la possibilità di effettuare il sort in base a parametri diversi che non siano la data di pubblicazione.
Questo è il codice:
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset, $mosConfig_live_site, $mainframe, $mosConfig_cachepath, $mosConfig_cachetime;
$count = intval( $params->get( 'count', 5 ) );
$catid = trim( $params->get( 'catid' ) );
$secid = trim( $params->get( 'secid' ) );
$show_front = $params->get( 'show_front', 1 );
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
$imageWidth = intval($params->get('imageWidth', 50));
$thumb_width = intval($params->get('thumb_width', 1));
$thumb_filter = intval($params->get('thumb_filter', 1));
$thumb_filter_color = intval($params->get('thumb_filter_color', 1));
$class_title = trim( $params->get( 'class_title', 'contentheading' ) );
$vremya = $params->def('vremya', '1') ;
$class_date = trim( $params->get( 'class_date', 'createdate' ) );
$avtor = $params->def('avtor', '1') ;
$class_avtor = trim( $params->get( 'class_avtor', 'createdate' ) );
$sep = trim( $params->get( 'sep', ' || ' ) );
$class_sep = trim( $params->get( 'class_sep', 'createdate' ) );
$pik = $params->def('pik', '1') ;
$noimage = trim( $params->get( 'noimage' ) );
$listimg = trim( $params->get( 'listimg' ) );
$listimg_yes = $params->def('listimg_yes', '0');
$show_title = $params->def('show_title', '1');
$title_limit = trim( $params->get( 'title_limit', '10' ) );
$lt = $params->def('lt', '0');
$show_intro = $params->get( 'show_intro');
$introtext_limit = intval( $params->get( 'introtext_limit') );
$li = $params->def('li', '1');
$lmttext = $params->def('lmttext', '1');
$sectiontableentry = $params->def('sectiontableentry', '1');
$readmore = $params->get( 'readmore' );
$podrobnee = trim( $params->get( 'podrobnee', 'Read more...' ) );
$class_readmore = trim( $params->get( 'class_sep', 'createdate' ) );
$all_in = $params->def('all_in', '0') ;
$text_all_in = trim( $params->get( 'text_all_in', 'All in section/category...' ) );
$link_all_in = trim( $params->get( 'link_all_in', 'content/blogsection/1/1/' ) );
$class_all_in = trim( $params->get( 'class_all_in', 'small' ) );
$k = 0;
$now = date( 'Y-m-d H:i:s', time() );
$query = "SELECT a.id, a.title, a.images, a.created, u.name, a.created_by_alias, a.created_by, a.introtext"
. "\n FROM #__content AS a"
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by"
. "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
. "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid > '0' )"
. "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )"
. "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )"
. ( $catid ? "\n AND ( a.catid IN (". $catid .") )" : '' )
. ( $secid ? "\n AND ( a.sectionid IN (". $secid .") )" : '' )
. ( $show_front == "0" ? "\n AND f.content_id IS NULL" : '' )
. "\n ORDER BY a.created DESC LIMIT $count"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
//
echo '<!-- DGM News Ultra module created by Denys Nosov [Joomla! Ukraine - http://www.joomla-ua.org], 2006 -->
<!-- Start module -->
<table cellspacing="0" class="dgmnews'.$moduleclass_sfx.'">';
// 0
$dgm = 0;
//
foreach ( $rows as $row ) {
$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
$Itemid = '&Itemid='. $Itemid;
//
if ( $row->created_by_alias ) {
$author = $row->created_by_alias;
} else {
$author = htmlspecialchars( $row->name );
}
//
if ($lt==1){
$row->title = substr($row->title, 0, $title_limit).'...';
}
else { $row->title; }
//
if ($show_title) {
$show_title = '<a class="'.$class_title.'" href="'. sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid ) .'">'. $row->title .'</a><br />';
} else {
$show_title = '';
}
//
// ,
$row->introtext = preg_replace('#<.*?>#is', '' , $row->introtext);
$row->introtext = preg_replace('/{([a-zA-Z0-9\-_]*)\s*(.*?)}/i', '', $row->introtext);
// -
if ($li==1){
if ($lmttext==1){
// -
if ($introtext_limit) {
$word_arr = str_word_count($row->introtext, 2);
$c = 0;
foreach ($word_arr AS $k => $v) {
if ($c == $introtext_limit) {
$row->introtext = substr($row->introtext, 0, $k).'...';
break;
}
$c++;
}
}
}
else {
$row->introtext = substr($row->introtext, 0, $introtext_limit).'...';
}
}
else { $row->introtext; }
//
if ($sectiontableentry){
$sectiontableentry = 'sectiontableentry'. ($dgm+1);
}
else {
$sectiontableentry = '';
}
$row->id=intval($row->id);
if ($Itemid == NULL) {
$Itemid = '';
}
else {
$Itemid = '&Itemid='. $Itemid;
}
if (!empty ($row->images))
{
$image = explode("|", $row->images);
//
if ($thumb_width==1){
if ($thumb_filter==1){
if ($thumb_filter_color==1){
$dgmimg = $mosConfig_live_site .'/modules/mod_dgm-news_ultra/phpThumb.php?src=../../images/stories/'. $image[0] .'&w='. $imageWidth .'&fltr[]=sep';
}
else {
$dgmimg = $mosConfig_live_site .'/modules/mod_dgm-news_ultra/phpThumb.php?src=../../images/stories/'. $image[0] .'&w='. $imageWidth .'&fltr[]=gray';
}
}
else {$dgmimg = $mosConfig_live_site .'/modules/mod_dgm-news_ultra/phpThumb.php?src=../../images/stories/'. $image[0] .'&w='. $imageWidth;}
}
else {
$dgmimg = $mosConfig_live_site .'/images/stories/'. $image[0];
}
//
//
echo '<tr valign="top" class="'. $sectiontableentry .'">';
// :
if ($pik==1) {
echo '<td width="'. $imageWidth .'" class="dgmnews'. $moduleclass_sfx .'"><a href="'. sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid ) .'"><img src="'. $dgmimg .'" alt="'. $row->title .'" title="'. $row->title .'" align="left" border="0" width="'. $imageWidth .'" /></a></td>';
}
else { echo ''; }
//
echo'<td class="dgmnews'. $moduleclass_sfx .'">';
//
echo $show_title;
// :
if ($vremya) {
echo '<span class="'.$class_date.'">';
echo $vremya = mosFormatDate ($row->created, $params->get( 'date_format' ));
echo '</span>';
//
echo '<span class="'.$class_sep.'">'.$sep.'</span><br />';
}
else {
// -
if ($listimg_yes==1) { echo '<img src="'.$listimg.'" border="0">';}
};
//
if ($avtor==1) {
echo '<span class="'.$class_avtor.'">';
echo $author;
echo '</span><br />';
}
else {
echo '';
}
//
if ($show_intro==1) {
echo $row->introtext; }
// ...
if ($readmore==1) { echo '<br /><a class="'.$class_readmore.'" href="'. sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid ) .'">'.$podrobnee.'</a>';
}
}
//===============================================
// , :)
else {
//
echo '<tr valign="top" class="'. $sectiontableentry .'">';
if ($pik==1) {
echo '<td width="'.$imageWidth.'" class="dgmnews'.$moduleclass_sfx.'"><a href="'. sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid ) .'"><img src="'.$mosConfig_live_site.'/'.$noimage.'" alt="'. $row->title .'" title="'. $row->title .'" border="0" width="'.$imageWidth.'" style="margin-top: 0px; padding-top: 0px;"/></a></td>';
echo '';
}
else {
echo '';
}
echo'<td class="dgmnews'.$moduleclass_sfx.'">';
//
echo $show_title;
// :
if ($vremya) {echo '<span class="'.$class_date.'">';
echo $vremya = mosFormatDate ($row->created, $params->get( 'date_format' ));
echo '</span>';
echo '<span class="'.$class_sep.'">'.$sep.'</span>';
}
else {
if ($listimg_yes==1) { echo '<img src="'.$listimg.'" border="0">';}
};
//
if ($avtor==1) {
echo '<span class="'.$class_avtor.'">';
echo $author;
echo '</span><br />';
}
else {
echo '';
}
//
if ($show_intro==1) {
echo $row->introtext; }
//
if ($readmore==1) { echo '<br /><a class="'.$class_readmore.'" href="'. sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid ) .'">'.$podrobnee.'</a>';
}
}
echo '</td></tr>';
$dgm = 1 - $dgm;
}
echo '</table>';
// (1 2)
// /
if ($all_in==1) { echo '<a class="'.$class_all_in.'" href="'.$link_all_in.'">'.$text_all_in.'</a>';}
echo '<!-- End module -->';
?>
Si può fare una modica?
Grazie.