效果就是当前本站文章标题的效果: 在标题前面出现一个可以进行投票的顶 "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 是要发布的! 
Only registered users can write comments.
Please login or register.