打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
将最新文章模块hack成两列输出样式
 

下面是效果图:

 

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

 

最上行是后台可定义的一张图片,并带有 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?>

替换为:

// Outputif ($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里是因为这样好调试出效果来] .... 三个图片:

Permanent URL: http://www.autoit.cn/index.php/content/view/92/25.html
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
JOOMLA 修改组件,模块样式的模板
【Nginx36】Nginx学习:SSI静态文件服务器端包含模块
joomla源代码探析
php随机丢失部分会话
Joomla如何添加友言评论和百度分享
PEAR探奇之PEAR::Pager [一] - Haohappy的专栏--PHP5研究中...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服