Support jOOmla! Autoit!
 
将最新文章模块hack成两列输出样式[2] 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-12-23 | View Count View: 11484 | Digg Count Digg: 57

下面是效果图:

Image

 

上面是由下面改善的模块罗列在一起后实现的[模块复制]

Image 

最上行是后台可定义的一张图片,并带有 more定义的链接.

末尾的 more 是后台可定义的链接。

 

实现方法是依据上篇文章 “将最新文章模块hack成两列输出样式” 来完善的。

 

1, mod_latestnews.xml 结尾部分的

 </params>

  替换为:

<param name="image" type="text" size="45" default="" label="top_image" description="" />
  <param name="more" type="text"  size="45" default="" label="more link" description="" />
 </params>

 2, mod_latestnews.php 里的

$nullDate  = $database->getNullDate();

替换为:

$image   = trim( $params->get( 'image') );
$more   = trim( $params->get( 'more' ) );
$nullDate  = $database->getNullDate();

下面的 

// Output
?>

替换为:

// Output
 if ($image != "") echo '<div style="margin-bottom:5px;"><a href="'.$more.'">
<img src="'. $image.'" border="0"></a></div>';
?>

将:

<ul class="latestnews<?php echo $moduleclass_sfx; ?>">

替换为:

<table width='98%' border='0' class="latestnews<?php echo $moduleclass_sfx; ?>"
  cellspacing="0" cellpadding="0">

下面的:

foreach ( $rows as $row ) {

替换为:

 echo "<tr>\n";
 $rowcounter = 0;
 foreach ( $rows as $row ) {
    if (($rowcounter%2==0) AND ($rowcounter<>0)) echo "</tr>\n<tr>\n";

 

 

结尾的:

  ?>
<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>

替换为:

  if ($rowcounter%2==1) { 
   echo "<td width='4%' style=\"background: url(/images/gdot2.gif); background-position: center bottom; background-repeat: repeat-y;\"></td><td class=\"latestnews". $moduleclass_sfx."\" width=\"48%\" style=\"background: url(/images/gdot.gif); background-position: 2cm bottom; background-repeat: repeat-x; \" height=\"25\">";   
   } else { 
  echo "<td class=\"latestnews". $moduleclass_sfx."\" width=\"48%\" style=\"background: url(/images/gdot.gif); background-position: 2cm bottom; background-repeat: repeat-x; \" height=\"25\"  >"; 
 } ?>
 <img src="/images/con_dot.jpg" align="absbottom"> <a href="<?php echo $link; ?>" class="latestnews<?php echo $moduleclass_sfx; ?>">
 <?php echo $row->title; ?></a> <small>(<?php echo substr( $row->created,5,5 ); ?>)</small>
</td>
 <?php
 $rowcounter++;
}
if ($rowcounter%2<>0) {
  for ($i = 1; $i <= (2-($rowcounter%2)); $i++) {
  echo "<td width='4%' style=\"background: url(/images/gdot2.gif); background-position: center bottom; background-repeat: repeat-y;\"></td><td width='48%' style=\"background: url(/images/gdot.gif); background-position: 2cm bottom; background-repeat: repeat-x;\"><img src=\"/images/con_dot.jpg\"> <a href=\"".$more."\" class=\"latestnews". $moduleclass_sfx."\">more...</a></td>\n";
  }
}
echo "</tr>\n</table>\n";
?>

 Ok. End By Autoit 

 

常规设置:

1:此模块的标题不要显示, 因为要输出图片啦. 当然你模块里的图片未设置他就不会出现.

2:文章条目设置为奇数, 上面是设置9, 这样的话, more 才会显示...

3:此模块的标题显示 + 此模块的图片路径为空 + 上面设置为偶数  --》 效果等于 "将最新文章模块hack成两列输出样式" 一文的效果。

注意:  上面是针对一本地站点hack后,直接帖上来的, 未改动什么,所以里面涉及到3个小图片[/images/ 下面],一个是行的下划线, 一个是中间的竖线, 另一个是那个三角[没写在css里是因为这样好调试出效果来] .... 三个图片: ImageImageImage


Permanent URL: http://www.autoit.cn/index.php/content/view/92/25.html

Shares: Google书签 Yahoo书签 雅虎收藏夹 365Key网摘 新浪ViVi 百度收藏 天极网摘 diglog 和讯网摘 POCO网摘 YouNote网摘 博拉网 天下图摘 spurl blogmarks BlinkList reddit digg Del.icio.us   |  Tags: 最新文章  latestnews  hack  

 
自定义任意菜单下横幅图片的自定义显示   sef化后, 结尾增加.html 的方法