Joomla - Latest News group by day Mit Image

Zero-one_x

Grünschnabel
Hallo,
Ich möchte beim "Latest News group by day" Modul ein Feature einbauen, das ich ein Symbol der jeweiligen Kategorie anzeigen lassen kann. Ich hab nun im Forum von Joomla.de eine "Latest News with Images" Modifizierung gefunden die es möglich macht statt den Content Bild ein kategorien Bild anzuzeigen.
Ist es irgendwie möglich die Funktion vom Kategorie Bild in das "Latest News group by day" Modul einzubauen? Das hinter jeden Newstitel rechtsbündig ein Symbol der Kategorie erscheint?

Hab leider nicht die besten PHP Kenntnisse, könnte mir dabei jemand behilflich sein oder einen Tipp geben?

Die Module kann man in den folgenden Links herunterladen:

Latest News with Images

http://www.joomlaos.de/option,com_remository/Itemid,41/func,fileinfo/id,1149.html

Latest News group by day

http://www.joomlaos.de/option,com_remository/Itemid,41/func,fileinfo/id,1682.html


Und hier der Php Code von den beiden Modulen

"Latest News with Images" Modifiziert

Code:
<?php 
/** 
* @version $Id: mod_latestnews.php,v 1.16 2004/09/14 14:20:43 stingrey Exp $ 
* @package Mambo_4.5.1 
* @copyright (C) 2000 - 2004 Miro International Pty Ltd 
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL 
* Mambo is Free Software 
* Modified to display first image in images field of item 
* Christian Meichtry (drcorbeille) chris@mambosphere.com 
*/ 

/** ensure this file is being included by a parent file */ 
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 

global $mosConfig_offset, $mosConfig_live_site, $mainframe; 

$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', 0)) ; 

$now = date( 'Y-m-d H:i:s', time()+$mosConfig_offset*60*60 ); 

$query = "SELECT a.id, a.title, a.sectionid, a.catid, a.images" 
. "\n FROM #__content AS a" 
. "\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(); 

// needed to reduce queries used by getItemid 
$bs = $mainframe->getBlogSectionCount(); 
$bc = $mainframe->getBlogCategoryCount(); 
$gbs = $mainframe->getGlobalBlogSectionCount(); 

// Output 
echo '<ul>'; 
foreach ( $rows as $row ) { 

$database->setQuery ( "SELECT image FROM #__categories WHERE id=$row->catid" ); 
$image2 = $database->loadResult(); 

$database->setQuery ( "SELECT name FROM #__categories WHERE id=$row->catid" ); 
$name = $database->loadResult(); 



    // get Itemid 
    $Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 
    // Blank itemid checker for SEF 
    if ($Itemid == NULL) { 
        $Itemid = ''; 
    } else { 
        $Itemid = '&amp;Itemid='. $Itemid; 
    } 
     
    if ($image2) 
        { 
        $width = ($imageWidth > 0) ? ' width="'.$imageWidth.'"' : '' ; 
        $image = explode("|", $row->images) ; 
        echo '<li><a href="'. sefRelToAbs( 'index.php?option=com_content&amp;task=view&amp;id='. $row->id . $Itemid ) .'"><img src="'.$mosConfig_live_site.'/images/stories/'.$image2.'" alt="'.$name.'" border="0"'.$width.'/>'. $row->title .'</a></li>'; 
        } 
    else 
        echo '<li><a href="'. sefRelToAbs( 'index.php?option=com_content&amp;task=view&amp;id='. $row->id . $Itemid ) .'">'. $row->title .'</a></li>'; 
     
} 
echo '</ul>'; 
?>


Und die php vom "Latest News group by day Modul"


Code:
<?php
/**
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Created and Modified by www.hieblmedia.de 
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset, $mosConfig_live_site, $mainframe;

$type 		= intval( $params->get( 'type', 1 ) );
$count 		= intval( $params->get( 'count', 5 ) );
$count 		= intval( $params->get( 'count', 5 ) );
$catid 		= trim( $params->get( 'catid' ) );
$secid 		= trim( $params->get( 'secid' ) );
$group_by_day = $params->get( 'group_by_day', 1 );
$show_front	= $params->get( 'show_front', 1 );
$class_sfx	= $params->get( 'moduleclass_sfx' );
$viewcontenttime = $params->get( 'viewcontenttime', 1 );
$dateformat = $params->get( 'dateformat', '%A, %d. %B %Y');
$ofdate = $params->get( 'ofdate', 0);
$todate = $params->get( 'todate', 0);
$sortdateby = $params->get( 'sortdateby', 1);
$cat_prefix = $params->get( 'cat_prefix', 0);
$cat_prefix_seperator = $params->get( 'cat_prefix_seperator', ':');
$cat_prefix_linkable = $params->get( 'cat_prefix_linkable', 1);

$imageWidth = intval($params->get('imageWidth', 0)) ;

$now 		= date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 );

$access = !$mainframe->getCfg( 'shownoauth' );

// select between Content Items, Static Content or both
switch ( $type ) {
	case 2: //Static Content only
		$query = "SELECT a.id, a.title, a.modified, a.created"
		. "\n FROM #__content AS a"
		. "\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 ."' )"
    	. ( $ofdate ? "\n AND a.created >= '".$ofdate."'" : '' )
    	. ( $todate ? "\n AND a.created <= '".$todate."'" : '' )
    	. ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' )
		. "\n ORDER BY a.created DESC LIMIT $count"
		;
		$database->setQuery( $query );
		$rows = $database->loadObjectList();
		break;

	case 3: //Both
		$query = "SELECT a.id, a.title, a.sectionid, a.modified, a.created"
		. "\n FROM #__content AS a"

		. "\n WHERE ( a.state = '1' AND a.checked_out = '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 ."' )"
    	. ( $ofdate ? "\n AND a.created >= '".$ofdate."'" : '' )
    	. ( $todate ? "\n AND a.created <= '".$todate."'" : '' )
    	. ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' )
		. "\n ORDER BY a.created DESC LIMIT $count"
		;
		$database->setQuery( $query );
		$rows = $database->loadObjectList();
		break;

	case 1:  //Content Items only
	default:
		$query = "SELECT a.id, a.title, a.sectionid, a.catid, a.modified, a.created"
		. "\n FROM #__content AS a"
		. "\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 ."' )"
    	. ( $ofdate ? "\n AND a.created >= '".$ofdate."'" : '' )
    	. ( $todate ? "\n AND a.created <= '".$todate."'" : '' )
    	. ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' )
		. ( $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();
		break;
}

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

// Output
?>
<div class="latestnews<?php echo $class_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 = $row->id"
				;
				$database->setQuery( $query );
				$Itemid = $database->loadResult();
				
				break;
	
			case 3:
				if ( $row->sectionid ) {
					$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
				} else {
					$query = "SELECT id"
					. "\n FROM #__menu"
					. "\n WHERE type = 'content_typed'"
					. "\n AND componentid = $row->id"
					;
					$database->setQuery( $query );
					$Itemid = $database->loadResult();
				}
				break;
	
			case 1:
			default:
				$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
				break;
		}
	

		if ($cat_prefix) {
			if ( $cat_prefix == 1) $select = 'name';
			if ( $cat_prefix == 2) $select = 'title';
				$query = "SELECT $select"
				. "\n FROM #__categories"
				. "\n WHERE id = '$row->catid'"
				;
				$database->setQuery( $query );
				$cat_prefix_txt = $database->loadResult();
				
				if ($cat_prefix_txt) { 
					if ($cat_prefix_linkable) {
						$cat_prefix_view = '<span class="cat_prefix"><a href="index.php?option=com_content&task=category&id='.$row->catid.'&Itemid=127">'.$cat_prefix_txt.'</a> '.$cat_prefix_seperator.'</span> ';
					} else {
						$cat_prefix_view = '<span class="cat_prefix">'.$cat_prefix_txt.' '.$cat_prefix_seperator.'</span> ';					
					}
				} 
		}
			
		if ($group_by_day) {	
			// Blank itemid checker for SEF
			if ($Itemid == NULL) {
				$Itemid = '';
			} else {
				$Itemid = '&amp;Itemid='. $Itemid;
			}
		$database->setQuery ( "SELECT image FROM #__categories WHERE id=$row->catid" ); 
$image2 = $database->loadResult(); 

			$link = sefRelToAbs( 'index.php?option=com_content&amp;task=view&amp;id='. $row->id . $Itemid );
			if ($sortdateby) {
				if($row->modified > $row->created) {
					$rowdate = explode("-", $row->modified);
				} else {
					$rowdate = explode("-", $row->created);
				}
			} else {
					$rowdate = explode("-", $row->created);			
			}
			// Split date
			$rowdate2 = explode(" ", $rowdate[2]);
			$rowtime = explode(":", $rowdate2[1]);
			$rowdatearray = array('year'=>$rowdate[0], 'month'=>$rowdate[1], 'day'=>$rowdate2[0], 'hour'=>$rowtime[0],'min'=>$rowtime[1],'sec'=>$rowtime[2] );
			$rowtimeview = $rowdatearray['hour'].':'.$rowdatearray['min'];
			$rowdateview = $rowdatearray['year'].'-'.$rowdatearray['month'].'-'.$rowdatearray['day'];
		    // end split
			if  ($lastdate!=$rowdateview) { 		
				echo ('<div class="latestnewsday'.$class_sfx.'">'.strftime("$dateformat", mktime(0, 0, 0, $rowdatearray['month'], $rowdatearray['day'], $rowdatearray['year'])).'</div>');
			}
			else { echo '';}
			$lastdate = $rowdatearray['year'].'-'.$rowdatearray['month'].'-'.$rowdatearray['day'];
			echo '<div class="latestnews'.$class_sfx.'" style="margin-left:10px; border-bottom:1px solid #cccccc; display:block; width:100%">';
			echo $cat_prefix_view;
			if ($viewcontenttime) { echo $rowtimeview.' - ' ; } 
			echo '<a href="'.$link.'" class="latestnews'.$class_sfx.'">';
			echo $row->title;
			echo '</a></div>';

		} else {
			// 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 );
			
			echo '<div class="latestnews'.$class_sfx.'" style="padding-left:5px;">';
			echo $cat_prefix_view;
			if($row->modified > $row->created) {
				echo $row->modified;
			} else {
				echo $row->created;
			}
			
			echo ' <a href="'.$link.'" class="latestnews'.$class_sfx.'">'.$row->title.'</a></div>';			
		}
	
	}
	
 // get Itemid 
    $Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 
   ?>
</div>

Gruß Zero-one
 

Neue Beiträge

Zurück