gegehelin 2008-7-27 11:10
可以给下以下这个模块的代码分析吗
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$newsidfront=intval( $params->def( 'catid', 0 ) );
$count = intval( $params->get( 'count', 5 ) );
$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 );
//从xml文件中得到参数.
$query = "SELECT a.id,a.catid,a.title,a.created as timesd"
. "\nFROM #__content AS a"
. "\nLEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
. "\nWHERE (f.content_id IS NULL AND a.state='1' AND a.checked_out='0' AND a.sectionid > '0' AND a.catid ='$newsidfront')"
. "\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')"
. "\nORDER BY a.created DESC LIMIT $count";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE componentid='$newsidfront'"
. "\n AND published='1'"
. "\n ORDER BY parent, ordering"
. "\n LIMIT 1";
$database->setQuery( $query );
$Itemid = $database->loadResult();
?>
<?php
if($rows){
foreach($rows as $row){
$securl=sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid");
?>
<li class="latestnews<?php echo $class_sfx; ?>">
<a href="<?php echo $securl; ?>" class="latestnews<?php echo $class_sfx; ?>">
<?php echo $row->title; ?>(<?php echo mosFormatDate($row->timesd);?>)</a>
</li>
<?php
}
}