Back to top

Autore Topic: Modulo newsflash tutte le sezioni  (Letto 3081 volte)

Offline ferraresi_4ever

  • Appassionato
  • ***
  • Post: 492
    • Mostra profilo
Modulo newsflash tutte le sezioni
« il: 14 Set 2007, 18:12:31 »
Allora, volevo che nel modulo newsflash si visualizzassero gli ultimi 5 contenuti inseriti, presi però da tutte le sezioni e categorie.
Ho provato a mettere nella configurazione del modulo ( alla voce section id ) i numeri di tutte le sezioni separate da virgola, ma niente! Esiste un modulo simile che fa ciò che voglio o comunque com è possibile modificarlo?

Offline ferraresi_4ever

  • Appassionato
  • ***
  • Post: 492
    • Mostra profilo
Re: Modulo newsflash tutte le sezioni
« Risposta #1 il: 15 Set 2007, 14:04:40 »
Ho provato a levare dal file newsflash.php alcune righe ( quelle del tipo : " WHERE a.catid = ecc ecc " ) ... ma non ho risolto nulla; quindi se c'è qualcuno che sa come modificare il modulo o ne conosce uno che fa gia quello che chiedo me lo dica, altrimenti se entro le 5 o le 6 di stasera non ho una risposta mi metto a testare ttt i moduli che ho trovato e poi vi posto quello che più si addice alle mie richieste, in modo che possa servire anke a voi.

Offline ferraresi_4ever

  • Appassionato
  • ***
  • Post: 492
    • Mostra profilo
Re: Modulo newsflash tutte le sezioni
« Risposta #2 il: 15 Set 2007, 16:34:11 »
Ho provato i vari moduli, vi anticipo che quelli su http://extensions.joomla.org/ o servono per vedere le ultime notizie che scrollano ( solo della categoria news flash ) oppure fanno vedere le ultime notizie comprese di introduzione ..

Vabbè .. a questo punto posso solo postare qua il codice php del modulo e sperare che qualcuno sia cosi gentile da postarmi la modifica.
Ripeto, vorrei solo che il modulo visualizzasse le ultime notizie inserite, fra tutte le sezioni e categorie!

Codice: [Seleziona]
<?php
/**
* @version $Id: mod_latestnews.php 5069 2006-09-15 16:16:55Z friesengeist $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined'_VALID_MOS' ) or die( 'Restricted access' );

global 
$mosConfig_offset$mosConfig_live_site$mainframe;

$type  intval$params->get'type') );
$count  intval$params->get'count') );
$catid  trim$params->get'catid' ) );
$secid  trim$params->get'secid' ) );
$show_front $params->get'show_front');

$now  _CURRENT_SERVER_TIME;
$access  = !$mainframe->getCfg'shownoauth' );
$nullDate $database->getNullDate();
// select between Content Items, Static Content or both
switch ( $type ) {
case 2
//Static Content only
$query "SELECT a.id, a.title"
"\n FROM #__content AS a"
"\n WHERE ( a.state = 1 AND a.sectionid = 0 )"
"\n AND ( a.publish_up = " $database->Quote$nullDate ) . " OR a.publish_up <= " $database->Quote$now ) . " )"
"\n AND ( a.publish_down = " $database->Quote$nullDate ) . " OR a.publish_down >= " $database->Quote$now ) . " )"
. ( $access "\n AND a.access <= " . (int) $my->gid '' )
"\n ORDER BY a.created DESC"
;
$database->setQuery$query0$count );
$rows $database->loadObjectList();
break;

case 3
//Both
$whereCatid '';
if ($catid) {
$catids explode','$catid );
mosArrayToInts$catids );
$whereCatid "\n AND ( a.catid=" implode" OR a.catid="$catids ) . " )";
}
$whereSecid '';
if ($secid) {
$secids explode','$secid );
mosArrayToInts$secids );
$whereSecid "\n AND ( a.sectionid=" implode" OR a.sectionid="$secids ) . " )";
}
$query "SELECT a.id, a.title, a.sectionid, a.catid, cc.access AS cat_access, s.access AS sec_access, cc.published AS cat_state, s.published AS sec_state"
"\n FROM #__content AS a"
"\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
"\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"
"\n LEFT JOIN #__sections AS s ON s.id = a.sectionid"
"\n WHERE a.state = 1"
"\n AND ( a.publish_up = " $database->Quote$nullDate ) . " OR a.publish_up <= " $database->Quote$now ) . " )"
"\n AND ( a.publish_down = " $database->Quote$nullDate ) . " OR a.publish_down >= " $database->Quote$now ) . " )"
. ( $access "\n AND a.access <= " . (int) $my->gid '' )
$whereCatid
$whereSecid
. ( $show_front == '0' "\n AND f.content_id IS NULL" '' )
"\n ORDER BY a.created DESC"
;
$database->setQuery$query0$count );
$temp $database->loadObjectList();

$rows = array();
if (count($temp)) {
foreach ($temp as $row ) {
if (($row->cat_state == || $row->cat_state == '') &&  ($row->sec_state == || $row->sec_state == '') &&  ($row->cat_access <= $my->gid || $row->cat_access == '' || !$access) &&  ($row->sec_access <= $my->gid || $row->sec_access == '' || !$access)) {
$rows[] = $row;
}
}
}
unset($temp);
break;

case 1:  
default:
//Content Items only
$whereCatid '';
if ($catid) {
$catids explode','$catid );
mosArrayToInts$catids );
$whereCatid "\n AND ( a.catid=" implode" OR a.catid="$catids ) . " )";
}
$whereSecid '';
if ($secid) {
$secids explode','$secid );
mosArrayToInts$secids );
$whereSecid "\n AND ( a.sectionid=" implode" OR a.sectionid="$secids ) . " )";
}
$query "SELECT a.id, a.title, a.sectionid, a.catid"
"\n FROM #__content AS a"
"\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
"\n INNER JOIN #__categories AS cc ON cc.id = a.catid"
"\n INNER JOIN #__sections AS s ON s.id = a.sectionid"
"\n WHERE ( a.state = 1 AND a.sectionid > 0 )"
"\n AND ( a.publish_up = " $database->Quote$nullDate ) . " OR a.publish_up <= " $database->Quote$now ) . " )"
"\n AND ( a.publish_down = " $database->Quote$nullDate ) . " OR a.publish_down >= " $database->Quote$now ) . " )"
. ( $access "\n AND a.access <= " . (int) $my->gid " AND cc.access <= " . (int) $my->gid " AND s.access <= " . (int) $my->gid '' )
$whereCatid
$whereSecid
. ( $show_front == '0' "\n AND f.content_id IS NULL" '' )
"\n AND s.published = 1"
"\n AND cc.published = 1"
"\n ORDER BY a.created DESC"
;
$database->setQuery$query0$count );
$rows $database->loadObjectList();
break;
}


// needed to reduce queries used by getItemid for Content Items
if ( ( $type == ) || ( $type == ) ) {
$bs  $mainframe->getBlogSectionCount();
$bc  $mainframe->getBlogCategoryCount();
$gbs  $mainframe->getGlobalBlogSectionCount();
}

// Output
?>

<ul class="latestnews<?php echo $moduleclass_sfx?>">
<?php
foreach ( $rows as $row ) {
// get Itemid
switch ( $type ) {
case 2:
$query "SELECT id"
"\n FROM #__menu"
"\n WHERE type = 'content_typed'"
"\n AND componentid = " . (int) $row->id
;
$database->setQuery$query );
$Itemid $database->loadResult();
break;

case 3:
if ( $row->sectionid ) {
$Itemid $mainframe->getItemid$row->id00$bs$bc$gbs );
} else {
$query "SELECT id"
"\n FROM #__menu"
"\n WHERE type = 'content_typed'"
"\n AND componentid = " . (int) $row->id
;
$database->setQuery$query );
$Itemid $database->loadResult();
}
break;

case 1:
default:
$Itemid $mainframe->getItemid$row->id00$bs$bc$gbs );
break;
}

// Blank itemid checker for SEF
if ($Itemid == NULL) {
$Itemid '';
} else {
$Itemid '&amp;Itemid='$Itemid;
}

$link sefRelToAbs'index.php?option=com_content&amp;task=view&amp;id='$row->id $Itemid );
?>

<li class="latestnews<?php echo $moduleclass_sfx?>">
<a href="<?php echo $link?>" class="latestnews<?php echo $moduleclass_sfx?>">
<?php echo $row->title?></a>
</li>
<?php
}
?>

</ul>

 



Web Design Bolzano Kreatif