Support jOOmla! Autoit!
 
让文章标题处显示的活泼些 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-10-26 | View Count View: 17368 | Digg Count Digg: 86 | section & Category Category: fixed & hacked - 使用手记

 默认效果是 ,作者一行, 日期一行.

现在更改为: 作者,日期, 点击数为一行.

修改方法:

content.html.php

790行左右. [搜索 Writes Author name]

将 function Author 及 function CreateDate两个函数替换为下面的:

        /**
        * Writes Author name
        */
        function Author( &$row, &$params ) {  //hack by Autoit
        }
        /**        
        * Writes Create Date
        */
        function CreateDate( &$row, &$params ) {  //hack by Autoit
                $create_date = null;
                if ( intval( $row->created ) != 0 ) {
                        $create_date = mosFormatDate( $row->created );
                }
                                       ?>
                        <span  class="small">
<?php 
if ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
 echo '<img src="../images/author.gif" align="top" alt="Author"/>'
. _WRITTEN_BY . ' '.( $row->created_by_alias ? $row->created_by_alias : $row->author ) .'  |   ' ; } 
if ( $params->get( 'createdate' ) ) { 
 echo '<img src="../images/date.gif" align="top" alt="Date"/> Date:' . $create_date .'  |   ' ; }?>
<img src="../images/view.gif" align="top" alt="View Count"/> View: <?php echo $row->hits; ?>
</span>
                        <?php
        }
        /** 

然后把author.gif,date.gif,view.gif小图片下到你的 /images/下面就ok了!

效果就是排为一行...

注: 如果上面 View的值一直为 0 的话, 

 

将 content.php 1750 行的

$row->hits = 0;

改为:

 //$row->hits = 0;   //by Autoit

如果你还想把下面的 "单元-分类" 也显示在一行的话,那么这样做:

大概在754行[我的改过了,所以不是很准,但可以根据下面的搜索]

        /**
        * Writes Section
        */
        function Section( &$row, &$params ) {
                if ( $params->get( 'section' ) ) {
                                ?>
                                <span>
                                        <?php
                                        echo $row->section;
          // writes dash between section & Category Name when both are active
                                        if ( $params->get( 'category' ) ) {
                                                echo ' - ';
                                        }
                                        ?>
                                </span>
                        <?php
                }
        }
 
        /**
        * Writes Category
        */
        function Category( &$row, &$params ) {
                if ( $params->get( 'category' ) ) {
                        ?>
                        <span>
                                <?php
                                echo $row->category;
                                ?>
                        </span>
                        <?php
                }
        }

替换为:

       /**
        * Writes Section
        */
        function Section( &$row, &$params ) {
        }
 
        /**
        * Writes Category
        */
        function Category( &$row, &$params ) {
        }

 然后把此文章第一段里的:

                       <?php
        }
        /** 

替换为:

<?php if ( $params->get( 'section' ) ) {?>
        <span>  |  <img src="../images/sc.gif" align="top" alt="section & Category "/>
                <?php
                echo $row->section;
                // writes dash between section & Category Name when both are active
                if ( $params->get( 'category' ) ) {
                        echo ' - ';
                }
                ?>
        </span>
<?php }        if ( $params->get( 'category' ) ) {
                        ?>
                        <span>
                                <?php
                                echo $row->category;
                                ?>
                        </span>
                        <?php
                }
        }
 
        /** 

然后把找个sc.gif小图片放到你的 /images/下面就ok了!

当然上面的<span>可以删减掉.,.让代码更少些...

如果你的站点使用 blog 方式浏览的话. 那么还需要改:

function showBlogSection [content.php 630 行附近]  这段

在他下面大概65行左右的:

// Main data query
 $query = "SELECT a.id, a.title, a.title_alias, 

替换为:

// Main data query
 $query = "SELECT a.id, a.title, a.title_alias, a.hits, 

这样在你blog浏览的时候, views 就不会为空了. 

End.

 


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

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

4 访客 @ 2006-11-07 09:50:32 :
img标签这么写.. 
 
路径似乎会有一点小问题,我的站点不是装在根目录下,照这样改的话路径出错 
 
可不可以改成获取绝对路径或者先获取joomla的路径..
3 kick @ 2006-10-30 01:54:32 : 好东西!
:0k:) haaa... very vey thanks!
2 venson @ 2006-10-27 10:18:13 :
哈哈,这么快贴出来了 :p
1 crag @ 2006-10-26 17:44:39 : 漂亮级了,超级喜欢!
:01:)

Only registered users can write comments.
Please login or register.

« First « 1 2 » Last »
 
扩充big5_func的Gb互转utf8函数   最新文章模块增加断字加省略号功能