<!DOCTYPE html>
	<html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
	<head>
<title>&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41;</title>
<meta name="description" content="&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41; - Savefile - Windows -...">
<meta name="keywords" content="windows">
<meta name="news_keywords" content="windows">
<meta name="author" content="Trường thcs Trần Quang Khải">
<meta name="copyright" content="Trường thcs Trần Quang Khải &#91;phavaphu@gmail.com&#93;">
<meta name="robots" content="index, archive, follow, noodp">
<meta name="googlebot" content="index,archive,follow,noodp">
<meta name="msnbot" content="all,index,follow">
<meta name="google-site-verification" content="RcwYmWMVb8dh-0VdAvXEp4IOHtTN12pffjnuI5mDK1o">
<meta name="generator" content="NukeViet v4.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="article:author" content="http://thcstranquangkhai.edu.vn">
<meta property="og:title" content="&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41;">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Windows - https&#x3A;&#x002F;&#x002F;thcstranquangkhai.edu.vn&#x002F;index.php&#x002F;vi&#x002F;windows&#x002F;savefile&#x002F;nukeviet&#x002F;news-dua-ngoi-sao-rating-ra-trang-chu-va-trang-chuyen-muc-122.html">
<meta property="og:site_name" content="Trường thcs Trần Quang Khải">
<meta property="og:url" content="https://thcstranquangkhai.edu.vn/index.php/vi/windows/nukeviet/news-dua-ngoi-sao-rating-ra-trang-chu-va-trang-chuyen-muc-122.html">
<link rel="shortcut icon" href="https://thcstranquangkhai.edu.vn/uploads/favicon.ico">
<link rel="canonical" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/nukeviet/news-dua-ngoi-sao-rating-ra-trang-chu-va-trang-chuyen-muc-122.html">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/" title="Windows" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thuat-thuat-bai-giang-van-phong/" title="Windows - Thuật thuật Bài giảng - Văn phòng" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/bai-giang-e-learning/" title="Windows - Bài giảng E_Learning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/tai-lieu-su-dung-phan-mem-soan-giang-e-learning/" title="Windows - Tài liệu sử dụng phần mềm soạn giảng E_Learning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Tin-cong-nghe/" title="Windows - Microsoft PowerPoint" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/microsoft-word/" title="Windows - Microsoft Word" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/microsoft-excel/" title="Windows - Microsoft Excel" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/vnedu-phan-mem-nhap-diem/" title="Windows - VnEdu &#40;Phần mềm nhập điểm&#41;" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Thu-thuat-khac/" title="Windows - Thủ thuật khác" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-phan-mem-internet/" title="Windows - Thủ thuật Phần mềm - Internet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/proshow-proceducer/" title="Windows - Proshow Proceducer" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/internet/" title="Windows - Internet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/nukeviet/" title="Windows - NukeViet" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-blogspot/" title="Windows - Thủ thuật Blogspot" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-usb/" title="Windows - Thủ thuật USB" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/thu-thuat-youtube/" title="Windows - Thủ thuật Youtube" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Download-Upload/" title="Windows - Download - Upload" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/may-chieu-projector/" title="Windows - Máy chiếu - Projector" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/photoshop/" title="Windows - Photoshop" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/driver/" title="Windows - Driver" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/mang-xa-hoi/" title="Windows - Mạng xã hội" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/Windows/" title="Windows - Windows" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-soan-bai-giang-elearning/" title="Windows - Phần mềm soạn bài giảng Elearning" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/San-pham/" title="Windows - Phần mềm SGK tin THCS" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-6/" title="Windows - Phần mềm Tin lớp 6" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-7/" title="Windows - Phần mềm Tin lớp 7" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-8/" title="Windows - Phần mềm Tin lớp 8" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-lop-9/" title="Windows - Phần mềm Tin lớp 9" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-danh-cho-tieu-hoc/" title="Windows - Phần mềm tin dành cho Tiểu học" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tin-danh-cho-mam-non/" title="Windows - Phần mềm tin dành cho Mầm non" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/giang-day-hoc-tap/" title="Windows - Giảng dạy - Học tập" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-tap-huan/" title="Windows - Phần mềm tập huấn" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/ung-dung-van-phong/" title="Windows - Ứng dụng Văn phòng" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-phavaphu/" title="Windows - Phần mềm phavaphu" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/he-dieu-hanh/" title="Windows - Hệ điều hành" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/phan-mem-khac/" title="Windows - Phần mềm khác" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/qt/" title="Windows - QT" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/ban-ghost-win/" title="Windows - Bản Ghost Win" type="application/rss+xml">
<link rel="alternate" href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/rss/lap-trinh-di-dong/" title="Windows - Lập trình di động" type="application/rss+xml">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.min.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.min.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/theia-sticky-sidebar.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/language/vi.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/global.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/news.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.cookie.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/main.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/custom.js">
<link rel="preload" as="script" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/bootstrap.min.js">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/assets/css/font-awesome.min.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/bootstrap.non-responsive.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/style.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/news.css">
<link rel="StyleSheet" href="https://thcstranquangkhai.edu.vn/assets/css/defaultphavaphu.vi.0.css?t=77">
<link href="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/css/animate.css" rel="stylesheet">
<style>
	body{background: #fff;}
</style>
		<!-- BEGIN: thông báo đẩy js -->
		<!-- END: thông báo đẩy js -->
<script data-show="inline">(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-81359612-1', '.thcstranquangkhai.edu.vn');
ga('send', 'pageview');
</script>
</head>
	<body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">Trường thcs Trần Quang Khải</h2>
		<p class="pull-right"><a title="Trường thcs Trần Quang Khải" href="https://thcstranquangkhai.edu.vn/">https://thcstranquangkhai.edu.vn</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41;</h1>
		<ul class="list-inline">
			<li>Thứ sáu - 05/08/2016 20:36</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
						<div class="pull-left imghome">
				<img alt="&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41;" src="https://s5.postimg.org/orzgx276f/5555.jpg" width="100" class="img-thumbnail" />
			</div>
			Áp dụng cho: NukeViet 4.0.29<br /><br />Module: News.<br /><br />Các file can thiệp :<br /><br />+ CSS: news.css<br /><br />+ PHP: theme.php, viewcat.php, main.php<br /><br />+ TPL: viewcat_main_right.tpl, viewcat_page.tpl<br /><br />Các chế độ sẽ hiển thị: Danh sách, mới(cũ) lên trên; Chuyên mục,tin khác nằm bên phải.<br /><br />Các chế độ hiển thị khác thì can thiệp tương tự.
		</div>
		<div id="bodytext" class="clearfix">
			<div style="text-align:center"><a data-image-count="139" href="https://nuke.vn/forum/attachments/a0977a88d541b75ac0abdca1c0e69088/" rel="image"><img alt="" height="482" src="https://s5.postimg.org/orzgx276f/5555.jpg" width="650" /></a></div>

<p><strong>Áp dụng cho: NukeViet 4.0.29</strong></p>

<p><u>Module</u>: News.</p>

<p>Các file can thiệp :</p>

<p>+&nbsp;<u>CSS</u>: news.css</p>

<p>+&nbsp;<u>PHP</u>: theme.php, viewcat.php, main.php</p>

<p>+&nbsp;<u>TPL</u>: viewcat_main_right.tpl, viewcat_page.tpl</p>

<p><u>Các chế độ sẽ hiển thị</u>: Danh sách, mới(cũ) lên trên; Chuyên mục,tin khác nằm bên phải.</p>

<p>Các chế độ hiển thị khác thì can thiệp tương tự.</p>

<p>Quy tắc vàng: Luôn luôn sao lưu !</p>

<p><strong>Cách làm:</strong></p>

<p><u><strong>CSS:</strong></u></p>

<p>Thêm vào cuối news.css code sau :</p>

<pre>
<code>.rating-box {
    color: #f0c808;
    line-height: 1;
    position: relative;
    white-space: nowrap;
    display: inline-block;
}
.rating-box span {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
    line-height: 1;
}</code></pre>

<p>Code này sẽ hiện ngôi sao màu vàng đẹp rạng rỡ và đúng vị trí.</p>

<p>Bạn có thể sửa #f0c808 thành mã màu mà bạn mong muốn.</p>

<p><u><strong>PHP:</strong></u></p>

<p><u>Với theme.php:</u></p>

<p><strong>01/ Tìm</strong></p>

<pre>
<code>viewcat_page_new($array_catpage, $array_cat_other, $generate_page)</code></pre>

<p>Tìm khá lâu bên dưới dòng đó, khoảng 180-185 :</p>

<pre>
<code>    $a = 0;
    foreach ($array_catpage as $array_row_i) {
</code></pre>

<p>thêm code này vào dưới:</p>

<pre>
<code>		$rating_width = 0;
		if(!empty($array_row_i&#91;&#039;numberrating&#039;&#93;)){
			$rating_width = $array_row_i&#91;&#039;numberrating&#039;&#93;/5 * 100;
		}
		$xtpl-&gt;assign( &#039;RATING_WIDTH&#039;, $rating_width );
</code></pre>

<p>Khi đó ta có:</p>

<pre>
<code>    foreach ($array_catpage as $array_row_i) {
		$rating_width = 0;
		if(!empty($array_row_i&#91;&#039;numberrating&#039;&#93;)){
			$rating_width = $array_row_i&#91;&#039;numberrating&#039;&#93;/5 * 100;
		}
		$xtpl-&gt;assign( &#039;RATING_WIDTH&#039;, $rating_width );

        $newday = $array_row_i&#91;&#039;publtime&#039;&#93; + (86400 * $array_row_i&#91;&#039;newday&#039;&#93;);
        $array_row_i&#91;&#039;publtime&#039;&#93; = nv_date(&#039;d/m/Y h:i:s A&#039;, $array_row_i&#91;&#039;publtime&#039;&#93;);
        $array_row_i&#91;&#039;listcatid&#039;&#93; = explode(&#039;,&#039;, $array_row_i&#91;&#039;listcatid&#039;&#93;);
        $num_cat = sizeof($array_row_i&#91;&#039;listcatid&#039;&#93;);
</code></pre>

<p>Vậy là xong phần Xem tin theo danh sách của bước này.</p>

<p><strong>02/ Tìm</strong></p>

<pre>
<code>function viewsubcat_main($viewcat, $array_cat)
</code></pre>

<p>Tìm đoạn này bên dưới dòng đó:</p>

<pre>
<code>                    $xtpl-&gt;assign(&#039;CONTENT&#039;, $array_row_i);
</code></pre>

<p>Thêm vào bên dưới:</p>

<pre>
<code>					$rating_width = 0;
					if(!empty($array_row_i&#91;&#039;numberrating&#039;&#93;)){
						$rating_width = $array_row_i&#91;&#039;numberrating&#039;&#93;/5 * 100;
					}
					$xtpl-&gt;assign( &#039;RATING_WIDTH&#039;, $rating_width );
</code></pre>

<p>Khi đó ta có:</p>

<pre>
<code>                if ($a == 1) {
                    if ($newday &gt;= NV_CURRENTTIME) {
                        $xtpl-&gt;parse(&#039;main.listcat.newday&#039;);
                    }
                    $xtpl-&gt;assign(&#039;CONTENT&#039;, $array_row_i);
					$rating_width = 0;
					if(!empty($array_row_i&#91;&#039;numberrating&#039;&#93;)){
						$rating_width = $array_row_i&#91;&#039;numberrating&#039;&#93;/5 * 100;
					}
					$xtpl-&gt;assign( &#039;RATING_WIDTH&#039;, $rating_width );
                    if ($array_row_i&#91;&#039;imghome&#039;&#93; != &quot;&quot;) {
</code></pre>

<p>Vậy là xong phần theme.php.</p>

<p><u>Với main.php:</u></p>

<p><strong>Tìm :</strong></p>

<pre>
<code>    } elseif ($viewcat == &#039;viewcat_page_new&#039; or $viewcat == &#039;viewcat_page_old&#039;) {
</code></pre>

<p>&nbsp;</p>

<p>Tìm dòng bên dưới nó, khoảng 81 là :</p>

<pre>
<code>            $array_catpage&#91;&#93; = $item;
</code></pre>

<p>Thêm vào bên trên nó</p>

<pre>
<code>			$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
</code></pre>

<p>Khi đó ta có :</p>

<pre>
<code>            $item&#91;&#039;newday&#039;&#93; = $global_array_cat&#91;$item&#91;&#039;catid&#039;&#93;&#93;&#91;&#039;newday&#039;&#93;;
            $item&#91;&#039;link&#039;&#93; = $global_array_cat&#91;$item&#91;&#039;catid&#039;&#93;&#93;&#91;&#039;link&#039;&#93; . &#039;/&#039; . $item&#91;&#039;alias&#039;&#93; . &#039;-&#039; . $item&#91;&#039;id&#039;&#93; . $global_config&#91;&#039;rewrite_exturl&#039;&#93;;
			$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
            $array_catpage&#91;&#93; = $item;
            $end_publtime = $item&#91;&#039;publtime&#039;&#93;;
</code></pre>

<p>Làm tiếp với :</p>

<pre>
<code>    } elseif ($viewcat == &#039;viewcat_main_left&#039; or $viewcat == &#039;viewcat_main_right&#039; or $viewcat == &#039;viewcat_main_bottom&#039;) {
</code></pre>

<p>Tìm bên dưới của nó:</p>

<p>&nbsp;</p>

<pre>
<code>					$array_cat&#91;$key&#93;&#91;&#039;content&#039;&#93;&#91;&#93; = $item;
</code></pre>

<p>Thêm vào trên nó:</p>

<pre>
<code>					$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
</code></pre>

<p>Khi đó ta có:</p>

<pre>
<code>$item&#91;&#039;newday&#039;&#93; = $array_cat_i&#91;&#039;newday&#039;&#93;;
$item&#91;&#039;link&#039;&#93; = $array_cat_i&#91;&#039;link&#039;&#93; . &#039;/&#039; . $item&#91;&#039;alias&#039;&#93; . &#039;-&#039; . $item&#91;&#039;id&#039;&#93; . $global_config&#91;&#039;rewrite_exturl&#039;&#93;;
$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
$array_cat&#91;$key&#93;&#91;&#039;content&#039;&#93;&#91;&#93; = $item;
</code></pre>

<p>Xong phần main.php.</p>

<p><u>Với viewcat.php:</u></p>

<p><u>Tìm:</u></p>

<pre>
<code>    if ($viewcat == &#039;viewcat_page_new&#039; or $viewcat == &#039;viewcat_page_old&#039; or $set_view_page) {
</code></pre>

<p>Thêm vào bên trên:</p>

<pre>
<code>			$array_catpage&#91;&#93; = $item;
</code></pre>

<p>Đoạn code sau:</p>

<pre>
<code>			$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
</code></pre>

<p>Khi đó ta có:</p>

<pre>
<code>$item&#91;&#039;newday&#039;&#93; = $global_array_cat&#91;$catid&#93;&#91;&#039;newday&#039;&#93;;
$item&#91;&#039;link&#039;&#93; = $global_array_cat&#91;$catid&#93;&#91;&#039;link&#039;&#93; . &#039;/&#039; . $item&#91;&#039;alias&#039;&#93; . &#039;-&#039; . $item&#91;&#039;id&#039;&#93; . $global_config&#91;&#039;rewrite_exturl&#039;&#93;;
$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
$array_catpage&#91;&#93; = $item;
$end_publtime = $item&#91;&#039;publtime&#039;&#93;;
</code></pre>

<p><u>Tìm:</u></p>

<pre>
<code>    } elseif ($viewcat == &#039;viewcat_main_left&#039; or $viewcat == &#039;viewcat_main_right&#039; or $viewcat == &#039;viewcat_main_bottom&#039;) {
</code></pre>

<p>Thêm vào bên trên:</p>

<pre>
<code>$array_catcontent&#91;&#93; = $item;
</code></pre>

<p>Đoạn code này:</p>

<pre>
<code>$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
</code></pre>

<p>Ta sẽ có:</p>

<pre>
<code>	$item&#91;&#039;newday&#039;&#93; = $global_array_cat&#91;$catid&#93;&#91;&#039;newday&#039;&#93;;
	$item&#91;&#039;link&#039;&#93; = $global_array_cat&#91;$catid&#93;&#91;&#039;link&#039;&#93; . &#039;/&#039; . $item&#91;&#039;alias&#039;&#93; . &#039;-&#039; . $item&#91;&#039;id&#039;&#93; . $global_config&#91;&#039;rewrite_exturl&#039;&#93;;
	$item&#91;&#039;numberrating&#039;&#93; = ( $item&#91;&#039;click_rating&#039;&#93; &gt; 0 ) ? round( $item&#91;&#039;total_rating&#039;&#93; / $item&#91;&#039;click_rating&#039;&#93;, 1 ) : 0;
	$array_catcontent&#91;&#93; = $item;
}
unset($sql, $result);
</code></pre>

<p>Xong phần viewcat.php.</p>

<p>Xong phần PHP.</p>

<p><strong><u>TPL:</u></strong></p>

<p>Mở viewcat_main_right.tpl, tìm</p>

<pre>
<code>&lt;/h3&gt;</code></pre>

<p>Thêm vào bên dưới:</p>

<pre>
<code>					&lt;p&gt;
						&lt;span class=&quot;rating-box&quot;&gt;
							&lt;i class=&quot;fa fa-star-o&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;i class=&quot;fa fa-star-o&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;i class=&quot;fa fa-star-o&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;i class=&quot;fa fa-star-o&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;i class=&quot;fa fa-star-o&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;span style=&quot;width:{RATING_WIDTH}%;&quot;&gt;
								&lt;i class=&quot;fa fa-star&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
								&lt;i class=&quot;fa fa-star&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
								&lt;i class=&quot;fa fa-star&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
								&lt;i class=&quot;fa fa-star&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
								&lt;i class=&quot;fa fa-star&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
							&lt;/span&gt;
						&lt;/span&gt;
						&lt;em class=&quot;text-muted&quot;&gt;({CONTENT.click_rating} {LANG.rating_count})&lt;/em&gt;
					&lt;/p&gt;
</code></pre>

<p>Xong viewcat_main_right.tpl</p>

<p>02/ Mở viewcat_page.tpl:</p>

<p>Làm y như bên trên.</p>

<p>Khi đó trang chủ/Các chuyên mục nếu cấu hình như bên trên sẽ hiện số sao và số lượt đánh giá của mỗi tin.</p>

<div style="text-align:center"><a data-image-count="139" href="https://nuke.vn/forum/attachments/a0977a88d541b75ac0abdca1c0e69088/" rel="image"><img alt="" height="482" src="https://s5.postimg.org/orzgx276f/5555.jpg" width="650" /></a></div>

<p>Bạn có thể tải về các File được nhắc tới trong bài viết này để tham khảo ở phần đính kèm. <a href="https://nuke.vn/forum/attachments/c2506dc0310bdd5db84fbfd2dfe9939b/" target="_blank">Tại đây</a></p>
		</div>
				<div id="author">
						<p>
				<strong>Tác giả bài viết:</strong>
				anhyeuviolet
			</p>
						<p>
				<strong>Nguồn tin:</strong>
				nuke.vn
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://thcstranquangkhai.edu.vn/index.php/vi/windows/nukeviet/news-dua-ngoi-sao-rating-ra-trang-chu-va-trang-chuyen-muc-122.html" title="&#91;News&#93; Đưa ngôi sao &#40; Rating &#41; ra trang chủ &#40; và trang chuyên mục &#41;">https://thcstranquangkhai.edu.vn/index.php/vi/windows/nukeviet/news-dua-ngoi-sao-rating-ra-trang-chu-va-trang-chuyen-muc-122.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; Trường thcs Trần Quang Khải
		</div>
		<div id="contact">
			<a href="mailto:phavaphu@gmail.com">phavaphu@gmail.com</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://thcstranquangkhai.edu.vn/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<div id="run_cronjobs" style="visibility:hidden;display:none;"><img alt="" src="/index.php?second=cronjobs&amp;p=c7p1f8kW" width="1" height="1" /></div>
<script src="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="windows",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=7,nv_my_abbr="+07",nv_cookie_prefix="nv4c_y197C",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_is_recaptcha=0;</script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/wow.min.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/theia-sticky-sidebar.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/language/vi.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/global.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/news.js"></script>
<script src="https://thcstranquangkhai.edu.vn/assets/js/jquery/jquery.cookie.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/main.js"></script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/custom.js"></script>
<script type="text/javascript">
    (function(p,u,s,h){
        p._pcq=p._pcq||[];
        p._pcq.push(['_currentTime',Date.now()]);
        s=u.createElement('script');
        s.type='text/javascript';
        s.async=true;
        s.src='https://cdn.pushcrew.com/js/00454aebdd272f8e4c5a5b5e50ac4513.js';
        h=u.getElementsByTagName('script')[0];
        h.parentNode.insertBefore(s,h);
    })(window,document);
</script>
<script src="https://thcstranquangkhai.edu.vn/themes/defaultphavaphu/js/bootstrap.min.js"></script>
</body>
</html>