Support jOOmla! Autoit!
文章里显示星期出现乱码的解决方法 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-10-31 | View Count View: 10237 | Digg Count Digg: 54

在语言文档里涉及到个 "_DATE_FORMAT_LC" 就是获取本地时间格式. 这样的话,如果在 utf-8站点上服务器不支持zh_CN.UTF-8的情况下显示星期通常会出现乱码.解决方法,在输出时间的地方,把编码转一下就好了.

在显示文章地方, 有下面两个. 我用 icovn 来转.

修改: content.html.php

<?php echo $row->created; ?>

 替换为:

<?php echo  iconv("GB2312","UTF-8",$row->created); ?>

在:

$create_date = mosFormatDate( $row->created );

下面加

$create_date = iconv("GB2312","UTF-8",$create_date);

这样乱码就不会出现了,如果服务器不支持 iconv 的话就只能用个 gb-->utf-8的函数了.

 
让文章标题处显示的活泼些 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-10-26 | View Count View: 16225 | Digg Count Digg: 86

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

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

修改方法:

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.

 

 
最新文章模块增加断字加省略号功能 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-10-25 | View Count View: 16714 | Digg Count Digg: 64

 最新文章 mod 增加断字:

修改/modules/mod_latestnews.php

defined( '_VALID_MOS' ) or die( 'Restricted access' );

下面插入[确信你有这个 utf8.php]:

require_once( 'includes/utf8.php' );

然后把结尾的:

<?php echo $row->title; ?>

替换为[可以是一行,在我换行的地方有个空格就行.]:

<?php if (utf8_strlen($row->title) > 20) 
$row->title = utf8_substr( $row->title, 0, 19)."..."; 
echo $row->title; ?>

即可。

上面意思是

当字符多于20个的话。就显示为 "前19个字符 加 ..."

 

接着给断字的标题加上 完整的提示:

在下面行

 <a href="<?php echo $link; ?>" class="latestnews<?php echo $moduleclass_sfx; ?>">

最后一个结尾的  > 前面增加:

   title='<?php echo $row->title; ?>'

就ok了。

 

热门文章 mod 的修改和这个是一样的!

 

假如你复制了好多个这样的模块,在不同的地方显示,而这个字符数又不同,那么你就要在xml里定义个变量来做了。

在mod_latestnews.xml里

 <params>

改为:

 <params>
  <param name="charecount" type="text" default="20" label="charecount" description="" />

mod_latestnews.php

$nullDate  = $database->getNullDate();

下面加上

$charecount = intval( $params->get( 'charecount', 20 ) );

上面的:

<?php if (utf8_strlen($row->title) > 20)  
$row->title = utf8_substr( $row->title, 0, 19)."..."; 
echo $row->title; ?>

要替换为:

<?php if (utf8_strlen($row->title) > $charecount)  
$row->title = utf8_substr( $row->title, 0, ($charecount-1))."..."; 
echo $row->title; ?>

保存上传,单独去设置吧!

 
使用Js来让IE支持png图片透明效果 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-10-22 | View Count View: 28792 | Digg Count Digg: 90

建立pngfix.js:

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
    var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
    var imgTitle = (myImage.title) ? 
               "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
    var imgStyle = "display:inline-block;" + myImage.style.cssText
    var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
    myImage.outerHTML = strNewHTML   
    }
}

使用方法 :

在模板的<HEAD> 段里加上[注意你的路径.]

<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

在要透明的 png 的地方格式为:

<img src="xyz.png" alt="foo" width="10" height="20" onload="fixPNG(this)">

注意, 你的图片的高与宽是不能去掉的! 就是多了 onload="fixpng(this)" 而已.


嘿嘿, 不详细? En好的话看这里 :http://homepage.ntlworld.com/bobosola

 

 
注册用户权限相关的一些 hack 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-09-25 | View Count View: 10246 | Digg Count Digg: 58

/components/com_registration/registration.php 137行:

 $row->id   = 0;
 $row->usertype  = '';
 $row->gid   = $acl->get_group_id( 'Registered', 'ARO' );

改为:

 $row->id   = 0;
 $row->usertype  = '';
 $row->gid   = $acl->get_group_id( 'Editor', 'ARO' );

这样的话, 只要注册成功就是 Editor 的权限了. 改为 Author 就是到 Author 群组了...

 

如果单纯的让 Registeres 能发文章的话, 可以改:

/includes/gacl.class.php 179行[// actions]上面增加:

  $this->_mos_add_acl( 'action', 'add', 'users', 'registered', 'content', 'own' );
就可以了, 当然 如果要更改什么权限的话, 基本也都在这个文件里., 照毛画虎就下来了...
 
« First « 1 2 3 4 5 6 7 8 9 10 » Last »

36 - 40 / 109