关于新闻模块修改的问题! 我下面是一个关于http://english.hnu.cn/ 这个网站的新闻模块,定义了公告栏,学院新闻,学院简报三个的模版,现在我就是想在学院新闻的每条新闻标题前面加上一个作者名 使其变为 [csoft2003]湖南大学这个应该怎样修改? 请问这样一加是不是影响其他两个模块?可以做到不影响嘛!? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?phpdefined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );global $mosConfig_offset,$imgnews;$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 );$count =intval( $params->def( 'count', 5 ) );//$count = @$params->count ? intval( $params->count ) : 5;$newsid = trim($params->get( 'newsid' ));//$newsid = @$params->newsid ? intval( $params->newsid ) : 0;$tuijian= trim($params->get( 'tuijian' ));$textcount=intval( $params->def( 'textcount', 0 ) );$textfrontcount=intval( $params->def( 'textfrontcount', 0 ) );$imgfront=intval( $params->def( 'imgfront', 0 ) );$timefront=intval( $params->def( 'timefront', 0 ) );$hitsfront=intval( $params->def( 'hitsfront', 0 ) );$scroll=intval( $params->def( 'scroll', 0 ) );$more=intval( $params->def( 'more', 0 ) );$newsidfront=intval( $params->def( 'newsidfront', 0 ) ); $fit_w = trim($params->get( 'imgwidth' )); $fit_h = trim($params->get( 'imgheight' ));?><?phpif($imgfront <> 0) { $query = "SELECT f.content_id, a.id, a.title, a.sectionid, a.catid, a.images, a.created" . "\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.images LIKE '%.%')" . "\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 1";$database->setQuery( $query );$rows = $database->loadObjectList();$imgnews="<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width=100%>";foreach ($rows as $row) { $img = explode("\n", $row->images); $ccimg = explode("|", $img[0]); $im = getimagesize (trim("images/stories/".$ccimg[0])); $width = $im[0]; $height = $im[1]; $imwh = $im[0] / $im[1]; if ($im[0] > $fit_w) { $width = $fit_w; $height = $fit_w * $imwh; } if ($height > $fit_h) { $height = $fit_h; $width = $fit_h * $imwh; } $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE componentid='$row->sectionid'" . "\n AND published='1'" . "\n ORDER BY parent, ordering" . "\n LIMIT 1" ; $database->setQuery( $query ); $Itemid = $database->loadResult(); $imgnews=$imgnews."<tr><td colspan=\"2\"><center><a href='".sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid")."'>";$imgnews=$imgnews."<img src='".$mosConfig_live_site."/images/stories/".$ccimg[0]."' border=0 width='".$width."' height='".$height."' alt='".$row->title." ".$row->created."'></a></center></td>";$imgnews=$imgnews."</tr><tr><td valign='top' align='center' width='4'><img src='".$mosConfig_live_site."/images/M_images/arrow.png' alt=''></td>";$imgnews=$imgnews."<td width='100%' style='border-bottom:1px dotted #e0e0e0'><a href='".sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid")."'>".$row->title."</a></td>";$imgnews=$imgnews."</tr>";}$imgnews=$imgnews."</table>";}else{$imgnews="";};$query = "SELECT id,title". "\n FROM #__categories". "\n WHERE ( published='1' AND access<='$my->gid' )". ( $newsidfront ? "\n AND ( id IN (". $newsidfront .") )" : '' ). "\n ORDER BY ordering DESC";$database->setQuery($query );$rows = $database->loadObjectList();if (($rows) || ($newsidfront<>0)){$query = "SELECT *" . "\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();?><table cellpadding="1" cellspacing="1" border="0" width="100%" ><tr><td width=<?php echo $width;?>><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td><?php echo $imgnews;?></td></tr></table></td><td width="100%" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="100%"><table width="100%" cellpadding="0" cellspacing="0" border="0"><?php $icount=0;foreach ($rows as $row) {$content="";//explode()函数用一个字符串作为分界来分解另一个字符串。 $date_elementsb = explode(" " ,$row->created); if($textfrontcount>$icount) { $content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid") . "\">".$row->title."</a><BR>".$row->introtext.$row->fulltext; }else {$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid") . "\">".$row->title."</a>"; }; if($hitsfront<>0) { $content .="<font class='small'>(".$row->hits.")</font>"; }; if($timefront<>0) { $content .=$date_elementsb[0]; }; ?> <tr> <td valign="top"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" /></td> <td style='border-bottom:1px dotted #e0e0e0'><?php echo $content;?></td> </tr> <?php $content="";$icount.=1;}?></table></td></tr></table></td></tr></table><?php}?><?php$query = "SELECT id,title,section". "\n FROM #__categories". "\n WHERE ( published='1' AND access<='$my->gid' )". ( $newsid ? "\n AND ( id IN (". $newsid .") )" : '' ). "\n ORDER BY ordering DESC";$database->setQuery($query );$coln=0;$content="";$rows = $database->loadObjectList();if ($rows) {$content.="<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr>"; foreach ($rows as $row) { if($row.access<=$my->gid){ $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE componentid='$row->section'" . "\n AND published='1'" . "\n ORDER BY parent, ordering" . "\n LIMIT 1" ; $database->setQuery( $query ); $Itemid = $database->loadResult(); $securl=sefRelToAbs("index.php?option=com_content&task=category§ionid=".$row->section."&id=".$row->id."&Itemid=$Itemid"); if ($scroll <> 0) { $content.="</tr>"; $content.="<tr><td width=\"50%\" valign=\"top\"><marquee direction=up height=150 scrolldelay=20 scrollamount=1 behavior=scroll onmouseover=\"this.stop()\" onmouseout=\"this.start()\" ><table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width='100%'>"; } else { $content.="<td width=\"50%\" valign=\"top\"><table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width='100%'>"; } $query="SELECT * from #__content" ."\n WHERE (state='1' AND checked_out='0')" ."\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now')" ."\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now')" ."\n AND (catid='$row->id')" ."\n ORDER BY created DESC LIMIT $count"; $database->setQuery($query); $cols =$database->loadObjectList(); if($cols) { $icount=0; foreach($cols as $col) { $content .="<tr><td valign=\"top\" style='border-bottom:1px dotted #e0e0e0'><img src=\"$mosConfig_live_site/images/M_images/indent2.png\" alt=\"\" />";//explode()函数用一个字符串作为分界来分解另一个字符串。这个例子$access_date通过字符串”/”来分解 $date_elementsb = explode(" " ,$col->created); if($textcount>$icount) { $content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$col->id&Itemid=$Itemid") . "\">".$col->title."</a><BR>".$col->introtext.$col->fulltext; }else {$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$col->id&Itemid=$Itemid") . "\">".$col->title."</a>"; }; if($hitsfront<>0) { $content .="<font class='small'>(".$col->hits.")</font>"; }; if($timefront<>0) { $content .=$date_elementsb[0]; }; $content .="<BR></td></tr>"; $icount=$icount+1; } if ($scroll <> 0) { $content .="</table></marquee><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"right\" ></td> "; } else { $content .="</table><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"right\" ></td> "; } if ($more <> 0) { $content .="<td align=\"right\"><a href=\"".$securl."\">更多...</a></td></tr></table></td>"; } else { $content .="</tr></table></td>"; } if ($coln) { $content.="</tr></table>"; $content.="<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr>"; $coln=0; } else { $coln=1; } } }// }// if ($coln=1) { $content .="</tr></table>"; }}?> 创建一个DateTime类型的错误 PHP 能访问本地(服务器)上其他盘下的文件吗? 求查找的方法!!!!!!!!!!!!!!! php 用哪个免费的cms做门户站比较好 submit判断问题 界分怎么的 请问关于文件锁flock的使用? php+access的问题 php上传pdf文件,一些特殊字符丢失 阿里云虚拟主机centos下百度编辑器上传后的图片权限为600不可读,怎么破? 请问PHP如何读取access数据库中的ole对象(.doc)? 求高手指点一下如何实现此种回帖模式。
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset,$imgnews;
$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 );
$count =intval( $params->def( 'count', 5 ) );
//$count = @$params->count ? intval( $params->count ) : 5;
$newsid = trim($params->get( 'newsid' ));
//$newsid = @$params->newsid ? intval( $params->newsid ) : 0;
$tuijian= trim($params->get( 'tuijian' ));
$textcount=intval( $params->def( 'textcount', 0 ) );
$textfrontcount=intval( $params->def( 'textfrontcount', 0 ) );
$imgfront=intval( $params->def( 'imgfront', 0 ) );
$timefront=intval( $params->def( 'timefront', 0 ) );
$hitsfront=intval( $params->def( 'hitsfront', 0 ) );
$scroll=intval( $params->def( 'scroll', 0 ) );
$more=intval( $params->def( 'more', 0 ) );
$newsidfront=intval( $params->def( 'newsidfront', 0 ) );
$fit_w = trim($params->get( 'imgwidth' ));
$fit_h = trim($params->get( 'imgheight' ));
?><?php
if($imgfront <> 0) {
$query = "SELECT f.content_id, a.id, a.title, a.sectionid, a.catid, a.images, a.created"
. "\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.images LIKE '%.%')"
. "\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 1";$database->setQuery( $query );$rows = $database->loadObjectList();$imgnews="<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width=100%>";
foreach ($rows as $row) {
$img = explode("\n", $row->images);
$ccimg = explode("|", $img[0]);
$im = getimagesize (trim("images/stories/".$ccimg[0]));
$width = $im[0];
$height = $im[1];
$imwh = $im[0] / $im[1];
if ($im[0] > $fit_w)
{
$width = $fit_w;
$height = $fit_w * $imwh;
}
if ($height > $fit_h)
{
$height = $fit_h;
$width = $fit_h * $imwh;
}
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE componentid='$row->sectionid'"
. "\n AND published='1'"
. "\n ORDER BY parent, ordering"
. "\n LIMIT 1"
;
$database->setQuery( $query );
$Itemid = $database->loadResult();
$imgnews=$imgnews."<tr><td colspan=\"2\"><center><a href='".sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid")."'>";
$imgnews=$imgnews."<img src='".$mosConfig_live_site."/images/stories/".$ccimg[0]."' border=0 width='".$width."' height='".$height."' alt='".$row->title." ".$row->created."'></a></center></td>";
$imgnews=$imgnews."</tr><tr><td valign='top' align='center' width='4'><img src='".$mosConfig_live_site."/images/M_images/arrow.png' alt=''></td>";
$imgnews=$imgnews."<td width='100%' style='border-bottom:1px dotted #e0e0e0'><a href='".sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid")."'>".$row->title."</a></td>";
$imgnews=$imgnews."</tr>";
}
$imgnews=$imgnews."</table>";
}else
{$imgnews="";};
$query = "SELECT id,title"
. "\n FROM #__categories"
. "\n WHERE ( published='1' AND access<='$my->gid' )"
. ( $newsidfront ? "\n AND ( id IN (". $newsidfront .") )" : '' )
. "\n ORDER BY ordering DESC"
;
$database->setQuery($query );
$rows = $database->loadObjectList();
if (($rows) || ($newsidfront<>0)){$query = "SELECT *"
. "\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();
?>
<table cellpadding="1" cellspacing="1" border="0" width="100%" >
<tr>
<td width=<?php echo $width;?>>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td>
<?php echo $imgnews;
?>
</td></tr></table></td>
<td width="100%" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td width="100%">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<?php
$icount=0;
foreach ($rows as $row) {
$content="";
//explode()函数用一个字符串作为分界来分解另一个字符串。
$date_elementsb = explode(" " ,$row->created);
if($textfrontcount>$icount) {
$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid") . "\">".$row->title."</a><BR>".$row->introtext.$row->fulltext;
}else
{$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$row->id&Itemid=$Itemid") . "\">".$row->title."</a>";
};
if($hitsfront<>0) {
$content .="<font class='small'>(".$row->hits.")</font>";
};
if($timefront<>0) {
$content .=$date_elementsb[0];
}; ?>
<tr>
<td valign="top"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" /></td>
<td style='border-bottom:1px dotted #e0e0e0'><?php echo $content;?></td>
</tr>
$content="";
$icount.=1;}?>
</table></td>
</tr></table>
</td></tr></table>
<?php
}
?><?php$query = "SELECT id,title,section"
. "\n FROM #__categories"
. "\n WHERE ( published='1' AND access<='$my->gid' )"
. ( $newsid ? "\n AND ( id IN (". $newsid .") )" : '' )
. "\n ORDER BY ordering DESC"
;
$database->setQuery($query );
$coln=0;
$content="";
$rows = $database->loadObjectList();
if ($rows) {
$content.="<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr>";
foreach ($rows as $row) {
if($row.access<=$my->gid){
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE componentid='$row->section'"
. "\n AND published='1'"
. "\n ORDER BY parent, ordering"
. "\n LIMIT 1"
;
$database->setQuery( $query );
$Itemid = $database->loadResult();
$securl=sefRelToAbs("index.php?option=com_content&task=category§ionid=".$row->section."&id=".$row->id."&Itemid=$Itemid");
if ($scroll <> 0)
{
$content.="</tr>";
$content.="<tr><td width=\"50%\" valign=\"top\"><marquee direction=up height=150 scrolldelay=20 scrollamount=1 behavior=scroll onmouseover=\"this.stop()\" onmouseout=\"this.start()\" ><table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width='100%'>";
}
else
{
$content.="<td width=\"50%\" valign=\"top\"><table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width='100%'>";
}
$query="SELECT * from #__content"
."\n WHERE (state='1' AND checked_out='0')"
."\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now')"
."\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now')"
."\n AND (catid='$row->id')"
."\n ORDER BY created DESC LIMIT $count";
$database->setQuery($query);
$cols =$database->loadObjectList();
if($cols) {
$icount=0;
foreach($cols as $col) {
$content .="<tr><td valign=\"top\" style='border-bottom:1px dotted #e0e0e0'><img src=\"$mosConfig_live_site/images/M_images/indent2.png\" alt=\"\" />";
//explode()函数用一个字符串作为分界来分解另一个字符串。这个例子$access_date通过字符串”/”来分解
$date_elementsb = explode(" " ,$col->created);
if($textcount>$icount) {
$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$col->id&Itemid=$Itemid") . "\">".$col->title."</a><BR>".$col->introtext.$col->fulltext;
}else
{$content .="<a href=\"". sefRelToAbs("index.php?option=com_content&task=view&id=$col->id&Itemid=$Itemid") . "\">".$col->title."</a>";
};
if($hitsfront<>0) {
$content .="<font class='small'>(".$col->hits.")</font>";
};
if($timefront<>0) {
$content .=$date_elementsb[0];
};
$content .="<BR></td></tr>";
$icount=$icount+1;
}
if ($scroll <> 0)
{
$content .="</table></marquee><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"right\" ></td> ";
}
else
{
$content .="</table><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"right\" ></td> ";
} if ($more <> 0)
{
$content .="<td align=\"right\"><a href=\"".$securl."\">更多...</a></td></tr></table></td>";
}
else
{
$content .="</tr></table></td>";
}
if ($coln) {
$content.="</tr></table>";
$content.="<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr>";
$coln=0;
} else {
$coln=1;
}
}
}//
}//
if ($coln=1) {
$content .="</tr></table>";
}
}
?>