Snack's 1967

Hãy nhanh tay Đăng kí và Đăng nhập để trở thành thành viên chính thức của ChiaSe365.Mobie.In và cùng thảo luận!
» » » Share Mod đánh giá bài viết cho JohnCMS

Share Mod đánh giá bài viết cho JohnCMS

Forum ChiaSe365.Mobie.In
Quockunplus * * Quockunplus (Thành Viên) [Off]
* 28-03-2016

Share Mod đánh giá bài viết cho mã nguồn JohnCMS
Hướng dẫn:
Import data:
PHP Code:

<?php
ALTER TABLE 
`forumADD `likesint(11not null default '0'ALTER TABLE `forumADD `likeint(11not null default '0'ALTER TABLE `forumADD `dislikeint(11not null default '0';
?>

Mở [blue]forum/index.php[/blue] tìm:
PHP Code:
<?php
'tema',
'users'
?>

Thêm vào phía trên đó
PHP Code:
<?php
'likes',
'like',
'dislike',
?>

Tìm tiếp:
PHP Code:
<?php
if ($res['kedit']) {
?>

Thêm vào bên trên hoặc chỗ nào tùy ý trong phạm vi khu vực hiển thị nội dung bài viết
PHP Code:
<?php
if ($i == 1) {
if(!isset(
$_SESSION['rate-'.$id]))
echo 
'
Đánh giá : . $id . '
\" style=\"color:red;\">Tốt - . $id . '&dis\" style=\"color:blue;\">Kém 
';
echo '';
echo ''.
$type1[' like'].' Like / '.$type1['dislike'].' Dislike
';
likeview(
$type1['like'], $type1['dislike']);
echo '
';
$like = 50 ;
$lkie1 = $like + $type1 [ 'like' ] - $type1 [ 'dislike' ];
$like1 = $type1 [ 'like' ] + $type1 [ 'dislike' ];
likeview2(
$type1['like'], $type1['dislike']);
echo '' . 
$diemlike . '/100 - 
';
echo '' . 
$like1 . ' phiếu
';
}
?>

Mở [blue]incfiles/core.php[/blue] thêm vào dưới cùng
PHP Code:
<?php
function likeimg2($n,$x=false){
$n=$n*20;
if(
$x){
$n=$n-5;
echo 
''.$n.'';
} else {
echo 
''.$n.'';
}
}
function 
likeview2($like,$unlike){
if(
$like==and $unlike==0){ likeimg2(5); } else {
$tong=$like+$unlike;
$thich=($like/$tong)*100;
if(
$thich >= 100){ likeimg2(5);}
elseif(
$thich >= 90){ likeimg2(5,true);}
elseif(
$thich >= 80){ likeimg2(4);}
elseif(
$thich >= 70){ likeimg2(3,true);}
elseif(
$thich >= 60){ likeimg2(3);}
elseif(
$thich >= 50){ likeimg2(3,true);}
elseif(
$thich >= 40){ likeimg2(2);}
elseif(
$thich >= 30){ likeimg2(2,true);}
elseif(
$thich >= 20){ likeimg2(1);}
elseif(
$thich >= 10){ likeimg2(1,true);}
elseif(
$thich == 0){ likeimg2(1); }
}}
function 
likeimg($n,$x=false){
$n $n*20;
if(
$x){
$n $n-5;
echo 
'.$n.'.png\" alt=\"Đánh giá '.$n.' %\" title=\"Đánh giá '.$n.' %\"/>';
} else {
echo '.
$n.'.png\" alt=\"Đánh giá '.$n.' %\" title=\"Đánh giá '.$n.' %\" />';
}
}
function likeview(
$like,$unlike){
if(
$like==0 and $unlike==0){ likeimg(5); } else {
$tong=$like+$unlike;
$thich=($like/$tong)*100;
if(
$thich >= 100){ likeimg(5);}
elseif(
$thich >= 90){ likeimg(5,true);}
elseif(
$thich >= 80){ likeimg(4);}
elseif(
$thich >= 70){ likeimg(3,true);}
elseif(
$thich >= 60){ likeimg(3);}
elseif(
$thich >= 50){ likeimg(3,true);}
elseif(
$thich >= 40){ likeimg(2);}
elseif(
$thich >= 30){ likeimg(2,true);}
elseif(
$thich >= 20){ likeimg(1);}
elseif(
$thich >= 10){ likeimg(1,true);}
elseif(
$thich == 0){ likeimg(1); }
}}
?>

Up 3 file [red]like.php[/red] vào [blue]/forum/includes[/blue] Upfile star lên thư mục images . Xong
Nguồn: Ovigame

Edited Quockunplus
(0)
- Tổng số 1 bình luận và lượt xem
Công cụ bài viết

Online: [0]Khách: [1]
ChiaSe365..!Thiết Kế Bởi NgUyễn PhÚc
-->