Support jOOmla! Autoit!
让文章标题处显示的活泼些 [续] Vote's hack 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-11-16 | View Count View: 31805 | Digg Count Digg: 329

效果就是当前本站文章标题的效果: 在标题前面出现一个可以进行投票的顶 "Digg" !

content.html.php 489行左右的  :

  if ( !$params->get( 'intro_only' ) ) {
   $results = $_MAMBOTS->trigger( 'onAfterDisplayTitle', array( &$row, &$params, $page ) );
   echo trim( implode( "\n", $results ) );
  }
  $results = $_MAMBOTS->trigger( 'onBeforeDisplayContent', array( &$row, &$params, $page ) );
  echo trim( implode( "\n", $results ) );

移动到:

// displays Item Title 上行的 <?php 的下面.

/mambots/content/mosvote.php 替换为下面内容.

<?php
/**
* @version $Id: mosvote.php 85 2005-09-15 23:12:03Z eddieajau $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
$_MAMBOTS->registerFunction( 'onBeforeDisplayContent', 'botVoting' );
function botVoting( &$row, &$params, $page=0 ) {
 global $Itemid;
 $id  = $row->id;
 $option = 'com_content';
 $task  = mosGetParam( $_REQUEST, 'task', '' );
 $html = '';
  $url = @$_SERVER['REQUEST_URI'];
  $url = ampReplace( $url );
  if (!$params->get( 'intro_only' ) && $task != "blogsection") {
   $html .= '<td><form method="post" action="' . sefRelToAbs( 'index.php' ) . '">';
   $html .= '<input src="./images/up.gif" class="button1" type="image" name="submit_vote" ';
   $html .= 'alt="'. _RATE_BUTTON .'" />';
   $html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" ';
   $html .= 'checked="checked" style="display:none"/>';
   $html .= '<input type="hidden" name="task" value="vote" />';
   $html .= '<input type="hidden" name="pop" value="0" />';
   $html .= '<input type="hidden" name="option" value="com_content" />';
   $html .= '<input type="hidden" name="Itemid" value="'. $Itemid .'" />';
   $html .= '<input type="hidden" name="cid" value="'. $id .'" />';
   $html .= '<input type="hidden" name="url" value="'. $url .'" />';
  $html .= '</form></td>';
  }
 return $html;
}
?>

保存个小图片 up.gif 放你你的 images目录下.

 

至于在标题下面和上一篇一样要显示出来顶的次数, 可以 在上次修改的地方:

View: <?php echo $row->hits; ?>

后面增加:

 |  <img src="./images/vote.gif" align="top" alt="Digg"/>  Digg:  
<?php echo intval( $row->rating_count ); ?>

就ok了.  

当然, 要使用这个,你的投票 bot 是要发布的!

 


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

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

« First « 1 2 » Last »
 
将单元内容列表 hack 成两列显示   文章里显示星期出现乱码的解决方法