View Single Post
Old 06.02.2005, 11:40   #1 (permalink)
cylando
Baby Mamber
 
Join Date: Jan 2005
Location: Vienna/Austria
Posts: 5
cylando is on a distinguished road
Question Latest News Hack

Ich habe bei mir den News-Hack Latest News with Images installiert.

Es funzt soweit auch wunderbar, allerdings möchte ich statt dem ersten Bild eines Beitrages das Bild der Kategorie anzeigen lassen.
Das soll dazu führen, das ein Besucher der Seite schon an diesem winzigen Bild vor dem News erkennt, aus welcher Kategorie die News stammen.

Nun stehe ich vor dem Problem, dass ich im PHP-Bereich ein richtiger Noob bin. Somit Fehlt mir das wissen, um diesen News-Hack so zu modifizieren, dass es meinen Bedürfnissen passt.

Ich habe sowohl einen Einführungstext - was aber in diesem Fall nicht so wichtig ist - erstellt und jeder Katergorie auch ein Bild zugeordnet.

Da liegt aber der Hase im Pfeffer, da ja Latest News w. Img. nicht angewiesen werden kann das Kategoriebild zu nehmen. Er nimmt automatisch das erste Bild des Contents. Und das ist was ich ändern möchte ...

Anbei der Quelltext von Latest News with Images:

PHP 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') );
$catid trim$params->get'catid' ) );
$secid trim$params->get'secid' ) );
$show_front $params->get'show_front');
$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 ) {
    
// get Itemid
    
$Itemid $mainframe->getItemid$row->id00$bs$bc$gbs );
    
// Blank itemid checker for SEF
    
if ($Itemid == NULL) {
        
$Itemid '';
    } else {
        
$Itemid '&amp;Itemid='$Itemid;
    }
    
    if (
$row->images)
        {
        
$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/'.$image[0].'" alt="'.$image[2].'" 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>';
?>
Ich schätze es hat etwas mit dem "Image" Befehl zu tun, aber wie schon gesagt, mir fehlt leider das Wissen ...

Ich hoffe Ihr könnt mir weiterhelfen und mir den richtigen Hinweis geben, was im php verändert werden muss, damit das Kategoriebild angezeigt wird.

Bin für jede Hilfe dankbar.

Last edited by cylando; 09.02.2005 at 08:18.
cylando is offline   Reply With Quote
Sponsored Links