В общем, нужна помощь что бы реализовать пользователей по рейтингу. Типа топ 10 пользователей.
На основу взял topusers.php ( может кто знает о чем я )
Исходник topusers.php
Code:
<?php
$page = "topusers";
include "header.php";
if(semods::get_setting('userpoints_enable_topusers') == 0) {
semods::redirect("home.php");
}
// MAXIMUM TOP USERS TO DISPLAY
$max_top_users = 10;
/*
// This one takes into account if userpoints are enabled for user, just extra data that would better not to get pulled (performance)
$query = "SELECT *
FROM se_semods_userpoints UP
JOIN se_users U
ON UP.userpoints_user_id = U.user_id
JOIN se_levels L
ON U.user_level_id = L.level_id
WHERE UP.userpoints_totalearned != 0 AND U.user_userpoints_allowed = 1 AND L.level_userpoints_allow = 1
ORDER BY UP.userpoints_totalearned DESC";
*/
$query = "SELECT UP.*,
U.*,
V.profileview_views
FROM se_semods_userpoints UP
JOIN se_users U
ON UP.userpoints_user_id = U.user_id
LEFT JOIN se_profileviews V
ON V.profileview_user_id = UP.userpoints_user_id
WHERE UP.userpoints_totalearned != 0
ORDER BY UP.userpoints_totalearned DESC";
$query .= " LIMIT $max_top_users";
$rows = $database->database_query( $query );
// GET THEM INTO AN ARRAY
$items = Array();
$dummy_user = new se_user();
$rank = 1;
while($row = $database->database_fetch_assoc($rows)) {
$dummy_user->user_info['user_id'] = $row['user_id'];
$dummy_user->user_info['user_photo'] = $row['user_photo'];
$dummy_user->user_info['user_username'] = $row['user_username'];
$dummy_user->user_info['user_lname'] = $row['user_lname'];
$dummy_user->user_info['user_fname'] = $row['user_fname'];
$dummy_user->user_info['user_displayname'] = $row['user_displayname'];
$dummy_user->user_displayname();
$row['user_photo'] = $dummy_user->user_photo('./images/nophoto.gif');
$row['user_displayname'] = $dummy_user->user_displayname;
$row['profileview_views'] = intval($row['profileview_views']);
$row['userpoints_rank'] = $rank++;
$items[] = $row;
}
// ASSIGN VARIABLES
$smarty->assign('items', $items);
include "footer.php";
?>
Исходник topusers.tpl
Code:
{include file='header.tpl' caption="Топ пользователей"}
{literal}
<style>
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {
display: inline-block;
}
/* Hide from IE Mac \*/
.clearfix {
display: block;
} /* End hide from IE Mac */ /* --- a /begin --- */
.uptopusers .entry {
padding: 10px 15px 0 15px;
border-bottom: 1px solid #F6F6F6;
}
.uptopusers .entry h2 {
font-size: 14px;
font-weight:bold;
margin: 0px;
padding: 0px;
margin-bottom: 5px;
}
.uptopusers .entry h2 span {
float: left;
}
.uptopusers .entry .entry_body {
margin-bottom: 10px;
}
.uptopusers .entry .image-wrap {
width: 100px;
float: left;
margin: 4px 15px 15px 0;
}
.upcontent1 a {
color: #4b4b4b;
text-decoration: underline;
}
.upcontent1 a:hover {
text-decoration: none;
}
.uptopusers .entry .upcontent1 {
width: 200px;
float: left;
}
.uptopusers .text {
padding-bottom: 10px;
}
.uptopusers .entry .options {
width: 255px;
float: left;
line-height: 17px;
}
.uptopusers .options ul {
padding: 0 0 5px 25px;
margin: 10px 0 0 0;
list-style: none;
font-size: 14px;
}
.uptopusers ul {
margin-left: 15px;
}
.uptopusers p,.uptopusers ol,.uptopusers ul {
padding-bottom: 15px;
font-size: 12px;
}
.uptopusers .options ul li {
padding: 1px 0 1px 12px;
}
.uptopusers ul li,.uptopusers ol li {
padding: 1px 0 1px 0;
}
</style>
{/literal}
<!-- TOP USERS -->
<table cellpadding='0' cellspacing='0' width='100%' style="margin-top: 20px">
<tr>
<td style='padding-right: 10px; vertical-align: top;'>
<div style="width: 640px; border: 1px solid #DDD" class="uptopusers">
{* LOOP USERS *}
{section name=item_loop loop=$items}
<div class="entry clearfix">
<div class="image-wrap">
<a title="{$items[item_loop].user_displayname}" href="{$url->url_create('profile',$items[item_loop].user_username)}">
<img border=0 class='photo' width='{$misc->photo_size($items[item_loop].user_photo,'100','100','w')}' alt="{$items[item_loop].user_displayname}" src="{$items[item_loop].user_photo}"/></a>
</div>
<div class="upcontent1" {if $smarty.section.item_loop.index == 0}style="width: 150px"{/if}>
<h2><a title="{$items[item_loop].user_displayname}" href="{$url->url_create('profile',$items[item_loop].user_username)}">{$items[item_loop].user_displayname}</a></h2>
<div class="text clearfix">
{lang_print id=100016857} {math equation="x+y;" x=$items[item_loop].user_rate y=60}%<br/>
{assign var=user_points value=$items[item_loop].userpoints_totalearned}
{assign var=user_points_totalearned value=$items[item_loop].userpoints_totalearned}
{lang_print id=100016858} {include file='user_points_staticrank.tpl'}<br/>
{lang_print id=100016859} {$items[item_loop].profileview_views}
</div>
</div>
{if $smarty.section.item_loop.index == 0}
<div style="padding-top: 18px; float: left; width: 50px">
</div>
{/if}
<div class="options">
<ul>
<!--<li><a href="">Send A Message to {$items[item_loop].user_displayname}</a></li>-->
<li><a href="{$url->url_create('profile',$items[item_loop].user_username)}">{lang_print id=100016860} </a></li>
<li><a href="{$url->url_create('blog',$items[item_loop].user_username)}">{lang_print id=100016862} </a></li>
</ul>
</div>
</div>
{/section}
</div>
</td>
</table>
{include file='footer.tpl'}
Вывод рейтинга уже настроен, в .tpl, и как я понял нужно копать в topusers.php, менял шатал ничего не выходит. Уже терпения не хватает. Кто может помогите, или дайте уже готовые примеры с одним смыслом.
Спасибо