Данный материал предоставлен сайтом ProWebber.cc исключительно в ознакомительных целях. Администрация не несет ответственности за его содержимое.
Скачать бесплатно Дополнительное применение рейтинга полной новости.
Скачать бесплатно Дополнительное применение рейтинга полной новости.
Написал для своего портала стильную штучку выводящую итог рейтинга
1) открыть файл /engine/modules/functions.php
======================Найти (примерно 234 строчка):
======================Ниже дописать:
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2) открыть файл /engine/modules/show.full.php
======================Найти (примерно 289 строчка):
======================Ниже дописать:
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
3) Картинку ratingx.png залить в ВАШ ШАБЛОН/images/ratingx.png
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
4) В ВАШ ШАБЛОН/style/engine.css прописать
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
5) В ШАБЛОН fullstory.tpl куда удобно вписать
инструкция и картинка внутри
а так же это можно применить (немного переписав) для стилей fullstory.tpl
пример работы http://kinomir.nbr.by/
1) открыть файл /engine/modules/functions.php
======================Найти (примерно 234 строчка):
HTML;
$rated .= "</div>";
return $rated;
}
$rated .= "</div>";
return $rated;
}
======================Ниже дописать:
//рейтинг икс
function ShowRatingx($id, $rating, $vote_num, $editor, $allow = true) {
global $lang;
if( $rating ) $rating = round( ($rating / $vote_num), 1 );
$rating1 = str_replace( ",", ".", $rating );
switch($rating1) {
case ($rating1 == 0.0):
$rating1 = '0';
break;
case ($rating1 <= 2.4):
$rating1 = '1';
break;
case ($rating1 <= 4.9):
$rating1 = '2';
break;
case ($rating1 <= 7.4):
$rating1 = '3';
break;
case ($rating1 <= 10.0):
$rating1 = '4';
break;
}
if( ! $allow ) {
$rated = <<<HTML
{$rating1}
HTML;
return $rated;
}
$rated .= <<<HTML
<div class="ratingx{$rating1}"></div>
HTML;
return $rated;
}
//рейтинг икс
function ShowRatingx($id, $rating, $vote_num, $editor, $allow = true) {
global $lang;
if( $rating ) $rating = round( ($rating / $vote_num), 1 );
$rating1 = str_replace( ",", ".", $rating );
switch($rating1) {
case ($rating1 == 0.0):
$rating1 = '0';
break;
case ($rating1 <= 2.4):
$rating1 = '1';
break;
case ($rating1 <= 4.9):
$rating1 = '2';
break;
case ($rating1 <= 7.4):
$rating1 = '3';
break;
case ($rating1 <= 10.0):
$rating1 = '4';
break;
}
if( ! $allow ) {
$rated = <<<HTML
{$rating1}
HTML;
return $rated;
}
$rated .= <<<HTML
<div class="ratingx{$rating1}"></div>
HTML;
return $rated;
}
//рейтинг икс
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2) открыть файл /engine/modules/show.full.php
======================Найти (примерно 289 строчка):
$tpl->set_block( "'\\[rating\\](.*?)\\[/rating\\]'si", "" );
}
}
======================Ниже дописать:
//рейтинг икс
if( $row['allow_rate'] ) {
$tpl->set( '{ratingx}', ShowRatingx( $row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_rating'] ) );
$tpl->set( '{vote-num}', $row['vote_num'] );
$tpl->set( '[rating]', "" );
$tpl->set( '[/rating]', "" );
} else {
$tpl->set( '{ratingx}', "" );
$tpl->set( '{vote-num}', "" );
$tpl->set_block( "'\\[rating\\](.*?)\\[/rating\\]'si", "" );
}
//рейтинг икс
if( $row['allow_rate'] ) {
$tpl->set( '{ratingx}', ShowRatingx( $row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_rating'] ) );
$tpl->set( '{vote-num}', $row['vote_num'] );
$tpl->set( '[rating]', "" );
$tpl->set( '[/rating]', "" );
} else {
$tpl->set( '{ratingx}', "" );
$tpl->set( '{vote-num}', "" );
$tpl->set_block( "'\\[rating\\](.*?)\\[/rating\\]'si", "" );
}
//рейтинг икс
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
3) Картинку ratingx.png залить в ВАШ ШАБЛОН/images/ratingx.png
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
4) В ВАШ ШАБЛОН/style/engine.css прописать
/*---Рейтинг икс---*/
.ratingx_form {
display:block;
width:330px;
height:102px;
margin:0;
padding:0;
}
.ratingx0 {
background:url(../images/ratingx.png) no-repeat 0 0;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx1 {
background:url(../images/ratingx.png) no-repeat 0 -102px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx2 {
background:url(../images/ratingx.png) no-repeat 0 -204px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx3 {
background:url(../images/ratingx.png) no-repeat 0 -306px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx4 {
background:url(../images/ratingx.png) no-repeat 0 -408px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
/*---Рейтинг икс---*/
.ratingx_form {
display:block;
width:330px;
height:102px;
margin:0;
padding:0;
}
.ratingx0 {
background:url(../images/ratingx.png) no-repeat 0 0;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx1 {
background:url(../images/ratingx.png) no-repeat 0 -102px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx2 {
background:url(../images/ratingx.png) no-repeat 0 -204px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx3 {
background:url(../images/ratingx.png) no-repeat 0 -306px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
.ratingx4 {
background:url(../images/ratingx.png) no-repeat 0 -408px;
display:block;
margin:0;
padding:0;
width:330px;
height:102px;
}
/*---Рейтинг икс---*/
////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
5) В ШАБЛОН fullstory.tpl куда удобно вписать
<div class="ratingx_form">{ratingx}</div>
инструкция и картинка внутри
ratingx_ot_d0gmatist.rar [917.54 Kb] (cкачиваний: 250)
MD5: 0d6bb1ce02c77927a633cf1a4703a88a
MD5: 0d6bb1ce02c77927a633cf1a4703a88a
а так же это можно применить (немного переписав) для стилей fullstory.tpl
пример работы http://kinomir.nbr.by/
Предыдущая Следующая