<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Cộng Đồng MyBB Việt Nam - Tutorials]]></title>
		<link>https://congdong.mybb.vn/</link>
		<description><![CDATA[Cộng Đồng MyBB Việt Nam - https://congdong.mybb.vn]]></description>
		<pubDate>Wed, 06 May 2026 03:23:26 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Đăng xuất chuyển hướng trở lại trang trước]]></title>
			<link>https://congdong.mybb.vn/Thread-tutorial-dang-xuat-chuyen-huong-tro-lai-trang-truoc</link>
			<pubDate>Mon, 04 Aug 2025 07:44:17 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://congdong.mybb.vn/member.php?action=profile&uid=1">JLP423</a>]]></dc:creator>
			<guid isPermaLink="false">https://congdong.mybb.vn/Thread-tutorial-dang-xuat-chuyen-huong-tro-lai-trang-truoc</guid>
			<description><![CDATA[Diễn đàn Mybb theo mặc định thì lúc đăng xuất thành viên sẽ được chuyển về trang chủ diễn đàn. Tut này sẽ chuyển thành viên lại trang đang xem.<br />
Mọi người vào tempalte header_welcomeblock_member<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>href="{&#36;mybb-&gt;settings['bburl']}/member.php?action=logout&amp;amp;logoutkey={&#36;mybb-&gt;user['logoutkey']}"</code></div></div><br />
và thay nó thành <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>href="#" data-logout-url="{&#36;mybb-&gt;settings['bburl']}/member.php?action=logout&amp;amp;logoutkey={&#36;mybb-&gt;user['logoutkey']}"</code></div></div><br />
sau đó thêm đoạn script này vào cuối trang<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;script&gt;<br />
&nbsp;&nbsp;document.addEventListener("DOMContentLoaded", function () {<br />
&nbsp;&nbsp;&nbsp;&nbsp;const logoutLink = document.querySelector(".logout-link");<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (logoutLink) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logoutLink.addEventListener("click", function (e) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.preventDefault();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const logoutUrl = logoutLink.getAttribute("data-logout-url");<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Save current page in session storage<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sessionStorage.setItem("afterLogoutRedirect", location.pathname + location.search);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now go to the logout URL (MyBB handles this)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = logoutUrl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;// After logout, if there's a redirect URL stored, go back to it<br />
&nbsp;&nbsp;&nbsp;&nbsp;const redirect = sessionStorage.getItem("afterLogoutRedirect");<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (redirect &amp;&amp; !document.referrer.includes("member.php")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sessionStorage.removeItem("afterLogoutRedirect");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Delay slightly to make sure logout is complete<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setTimeout(() =&gt; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = redirect;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}, 100);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;});<br />
&lt;/script&gt;</code></div></div>]]></description>
			<content:encoded><![CDATA[Diễn đàn Mybb theo mặc định thì lúc đăng xuất thành viên sẽ được chuyển về trang chủ diễn đàn. Tut này sẽ chuyển thành viên lại trang đang xem.<br />
Mọi người vào tempalte header_welcomeblock_member<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>href="{&#36;mybb-&gt;settings['bburl']}/member.php?action=logout&amp;amp;logoutkey={&#36;mybb-&gt;user['logoutkey']}"</code></div></div><br />
và thay nó thành <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>href="#" data-logout-url="{&#36;mybb-&gt;settings['bburl']}/member.php?action=logout&amp;amp;logoutkey={&#36;mybb-&gt;user['logoutkey']}"</code></div></div><br />
sau đó thêm đoạn script này vào cuối trang<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;script&gt;<br />
&nbsp;&nbsp;document.addEventListener("DOMContentLoaded", function () {<br />
&nbsp;&nbsp;&nbsp;&nbsp;const logoutLink = document.querySelector(".logout-link");<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (logoutLink) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logoutLink.addEventListener("click", function (e) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.preventDefault();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const logoutUrl = logoutLink.getAttribute("data-logout-url");<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Save current page in session storage<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sessionStorage.setItem("afterLogoutRedirect", location.pathname + location.search);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now go to the logout URL (MyBB handles this)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = logoutUrl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;// After logout, if there's a redirect URL stored, go back to it<br />
&nbsp;&nbsp;&nbsp;&nbsp;const redirect = sessionStorage.getItem("afterLogoutRedirect");<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (redirect &amp;&amp; !document.referrer.includes("member.php")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sessionStorage.removeItem("afterLogoutRedirect");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Delay slightly to make sure logout is complete<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setTimeout(() =&gt; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = redirect;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}, 100);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;});<br />
&lt;/script&gt;</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Hướng dẫn sửa lỗi edit popup menu bị missing hoặc offset quá nhiều]]></title>
			<link>https://congdong.mybb.vn/Thread-tutorial-huong-dan-sua-loi-edit-popup-menu-bi-missing-hoac-offset-qua-nhieu</link>
			<pubDate>Thu, 03 Jul 2025 08:33:57 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://congdong.mybb.vn/member.php?action=profile&uid=1">JLP423</a>]]></dc:creator>
			<guid isPermaLink="false">https://congdong.mybb.vn/Thread-tutorial-huong-dan-sua-loi-edit-popup-menu-bi-missing-hoac-offset-qua-nhieu</guid>
			<description><![CDATA[Trong phiên bản mybb 1.8, cái file jquery.plugins.min.js không thiết lập sai vị trí của popup của cái edit button nếu diễn đàn được đặt trong position:relative, nên khi bạn bấm nút edit, bạn sẽ ko thấy cái quickedit popup đâu.<br />
Đây là 2 cách sửa nhanh, hy vọng 1 trong 2 sẽ giúp bạn giải quyết vấn đề<br />
<br />
Cách 1: Thêm đoạn này vào headerinclude:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;script&gt;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;(function(&#36;){<br />
&nbsp;&nbsp;&nbsp;&nbsp;var current_popup = '';<br />
&nbsp;&nbsp;&nbsp;&nbsp;var PopupMenu = function(el, close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var el = &#36;(el);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup = this;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup_menu = &#36;("#" + el.attr('id') + "_popup");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(typeof close_in_popupmenu == 'undefined')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var close_in_popupmenu = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Opening Popup<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.open = function(e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.preventDefault();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(popup_menu.is(':visible'))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Setup popup menu<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var offset = el.offset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset.top += el.outerHeight();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// We only adjust if it goes out of the page (?)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((el.offset().left + popup_menu.outerWidth()) &gt; &#36;(window).width())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var adjust = popup_menu.outerWidth() - el.outerWidth();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var adjust = 0;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.css({<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position: 'absolute',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.show();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Closes the popup if we click outside the button (this doesn't seem to work properly - couldn't find any solutions that actually did - if we click the first item on the menu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Credits: http://stackoverflow.com/questions/1160880/detect-click-outside-element<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#36;('body, .popup_item').bind('click.close_popup', function(e) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&#36;(e.target).closest("#" + el.attr('id')).length == 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&#36;(e.target).closest("#" + el.attr('id')).length == 0 &amp;&amp; &#36;(e.target).closest("#" + el.attr('id') + '_popup').length == 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.close = function(e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.hide();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;.fn.popupMenu = function(close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return this.each(function()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup = new PopupMenu(this, close_in_popupmenu);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#36;(this).click(popup.open);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
})(jQuery);<br />
 &lt;/script&gt;</code></div></div><br />
Nếu cách trên không thành, thì Cách 2:<br />
<ol type="1" class="mycode_list"><li>Xóa hoặc đổi tên file jscripts/jquery.plugins.min.js<br />
</li>
<li>Tạo một copy của file jscripts/jquery.plugins.js và đổi tên thành jscripts/jquery.plugins.min.js<br />
</li>
<li>Mở file vừa tạo và đổi tên và tìm<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>            // Setup popup menu<br />
            var offset = el.offset();<br />
            offset.top += el.outerHeight();</code></div></div><br />
</li>
<li>Thay thế bằng<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>            // Setup popup menu<br />
            var offset = el.offset();<br />
            // WoM fix edit popup menu start<br />
            var el_parent = el.get(0).parentNode;<br />
            var popup_parent = popup_menu.get(0).parentNode;<br />
            if (el_parent === popup_parent)<br />
            {<br />
              offset = el.position();<br />
            }<br />
            // WoM fix edit popup menu end<br />
            offset.top += el.outerHeight();</code></div></div><br />
</li>
<li>Lưu file lại<br />
</li>
</ol>
<br />
Nguồn: <a href="https://community.mybb.com/thread-160142-post-1197221.html#pid1197221" target="_blank" rel="noopener" class="mycode_url">https://community.mybb.com/thread-160142...pid1197221</a>]]></description>
			<content:encoded><![CDATA[Trong phiên bản mybb 1.8, cái file jquery.plugins.min.js không thiết lập sai vị trí của popup của cái edit button nếu diễn đàn được đặt trong position:relative, nên khi bạn bấm nút edit, bạn sẽ ko thấy cái quickedit popup đâu.<br />
Đây là 2 cách sửa nhanh, hy vọng 1 trong 2 sẽ giúp bạn giải quyết vấn đề<br />
<br />
Cách 1: Thêm đoạn này vào headerinclude:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;script&gt;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;(function(&#36;){<br />
&nbsp;&nbsp;&nbsp;&nbsp;var current_popup = '';<br />
&nbsp;&nbsp;&nbsp;&nbsp;var PopupMenu = function(el, close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var el = &#36;(el);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup = this;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup_menu = &#36;("#" + el.attr('id') + "_popup");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(typeof close_in_popupmenu == 'undefined')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var close_in_popupmenu = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Opening Popup<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.open = function(e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.preventDefault();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(popup_menu.is(':visible'))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Setup popup menu<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var offset = el.offset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset.top += el.outerHeight();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// We only adjust if it goes out of the page (?)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((el.offset().left + popup_menu.outerWidth()) &gt; &#36;(window).width())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var adjust = popup_menu.outerWidth() - el.outerWidth();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var adjust = 0;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.css({<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position: 'absolute',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.show();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Closes the popup if we click outside the button (this doesn't seem to work properly - couldn't find any solutions that actually did - if we click the first item on the menu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Credits: http://stackoverflow.com/questions/1160880/detect-click-outside-element<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#36;('body, .popup_item').bind('click.close_popup', function(e) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&#36;(e.target).closest("#" + el.attr('id')).length == 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&#36;(e.target).closest("#" + el.attr('id')).length == 0 &amp;&amp; &#36;(e.target).closest("#" + el.attr('id') + '_popup').length == 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.close = function(e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;popup_menu.hide();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;.fn.popupMenu = function(close_in_popupmenu)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return this.each(function()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var popup = new PopupMenu(this, close_in_popupmenu);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#36;(this).click(popup.open);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
})(jQuery);<br />
 &lt;/script&gt;</code></div></div><br />
Nếu cách trên không thành, thì Cách 2:<br />
<ol type="1" class="mycode_list"><li>Xóa hoặc đổi tên file jscripts/jquery.plugins.min.js<br />
</li>
<li>Tạo một copy của file jscripts/jquery.plugins.js và đổi tên thành jscripts/jquery.plugins.min.js<br />
</li>
<li>Mở file vừa tạo và đổi tên và tìm<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>            // Setup popup menu<br />
            var offset = el.offset();<br />
            offset.top += el.outerHeight();</code></div></div><br />
</li>
<li>Thay thế bằng<br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>            // Setup popup menu<br />
            var offset = el.offset();<br />
            // WoM fix edit popup menu start<br />
            var el_parent = el.get(0).parentNode;<br />
            var popup_parent = popup_menu.get(0).parentNode;<br />
            if (el_parent === popup_parent)<br />
            {<br />
              offset = el.position();<br />
            }<br />
            // WoM fix edit popup menu end<br />
            offset.top += el.outerHeight();</code></div></div><br />
</li>
<li>Lưu file lại<br />
</li>
</ol>
<br />
Nguồn: <a href="https://community.mybb.com/thread-160142-post-1197221.html#pid1197221" target="_blank" rel="noopener" class="mycode_url">https://community.mybb.com/thread-160142...pid1197221</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Responsive layout cho ProStats plugin]]></title>
			<link>https://congdong.mybb.vn/Thread-tutorial-responsive-layout-cho-prostats-plugin</link>
			<pubDate>Wed, 28 May 2025 09:32:22 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://congdong.mybb.vn/member.php?action=profile&uid=1">JLP423</a>]]></dc:creator>
			<guid isPermaLink="false">https://congdong.mybb.vn/Thread-tutorial-responsive-layout-cho-prostats-plugin</guid>
			<description><![CDATA[Hello mọi người, theo yêu cầu của <dvz_me_placeholder id="0" /> , Joey share mọi người cách làm cho ProStat plugin đc responsive theo giao diện của diễn đàn. Mọi người làm theo hướng dẫn sau nha<br />
<br />
1. Mọi người thêm cái CSS này vào global.css hay gì đó tương tự của giao diện muốn dùng:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>/*Cái này để ẩn mấy cai categories*/<br />
@media only screen and (max-width: 1199px){<br />
&nbsp;&nbsp;&nbsp;&nbsp; .hide-prostats{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display: none;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
/*cái này để ẩn mấy cái thông tin nhỏ nhặt trong cái phần bài viết mới*/<br />
@media only screen and (max-width: 767px){<br />
&nbsp;&nbsp;&nbsp;&nbsp; .hide{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display: none;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
2. Mọi người tìm những cái templates trong phần <span style="font-weight: bold;" class="mycode_b">Global Templates</span> sau đây, và thay cái &lt;td&gt; đầu tiên thành cái này:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;td class="hide-prostats"&gt;</code></div></div><ol type="1" class="mycode_list"><li>prostats_mostreplies<br />
</li>
<li>prostats_mostreputation<br />
</li>
<li>prostats_mostthanks<br />
</li>
<li>prostats_mostviews<br />
</li>
<li>prostats_newmembers<br />
</li>
<li>prostats_topdownloads<br />
</li>
<li>prostats_topposters<br />
</li>
<li>prostats_topreferrers<br />
</li>
<li>prostats_topthreadposters<br />
</li>
</ol>
<br />
3. Tương tự như bước 2, các bạn cũng tìm những templates sau đây và thay cái &lt;td&gt; thành <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;td class="hide"&gt;</code></div></div><ol type="1" class="mycode_list"><li>prostats_newestposts_date<br />
</li>
<li>prostats_newestposts_forum<br />
</li>
<li>prostats_newestposts_head_date<br />
</li>
<li>prostats_newestposts_head_forum<br />
</li>
<li>prostats_newestposts_head_starter<br />
</li>
<li>prostats_newestposts_starter<br />
</li>
</ol>
<br />
Vậy là xong rồi đó. Mọi người có thể thay đổi chỉnh sửa theo ý mình muốn. Joey đã test thử nhiều cách và thấy cách này là đẹp nhất cho responsive view. Khi nào rảnh Joey up lên vài tấm hình demo cho<br />
<br />
Enjoy<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=98" target="_blank" title="">Screenshot 2025-05-28 225010.png</a> (Kích thước: 223,38 KB / Tải về: 2)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=99" target="_blank" title="">Screenshot 2025-05-28 224951.png</a> (Kích thước: 156,69 KB / Tải về: 3)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=100" target="_blank" title="">Screenshot 2025-05-28 224840.png</a> (Kích thước: 148,84 KB / Tải về: 2)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=101" target="_blank" title="">Screenshot 2025-05-28 224806.png</a> (Kích thước: 119,98 KB / Tải về: 3)
]]></description>
			<content:encoded><![CDATA[Hello mọi người, theo yêu cầu của <dvz_me_placeholder id="0" /> , Joey share mọi người cách làm cho ProStat plugin đc responsive theo giao diện của diễn đàn. Mọi người làm theo hướng dẫn sau nha<br />
<br />
1. Mọi người thêm cái CSS này vào global.css hay gì đó tương tự của giao diện muốn dùng:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>/*Cái này để ẩn mấy cai categories*/<br />
@media only screen and (max-width: 1199px){<br />
&nbsp;&nbsp;&nbsp;&nbsp; .hide-prostats{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display: none;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
/*cái này để ẩn mấy cái thông tin nhỏ nhặt trong cái phần bài viết mới*/<br />
@media only screen and (max-width: 767px){<br />
&nbsp;&nbsp;&nbsp;&nbsp; .hide{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display: none;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
2. Mọi người tìm những cái templates trong phần <span style="font-weight: bold;" class="mycode_b">Global Templates</span> sau đây, và thay cái &lt;td&gt; đầu tiên thành cái này:<br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;td class="hide-prostats"&gt;</code></div></div><ol type="1" class="mycode_list"><li>prostats_mostreplies<br />
</li>
<li>prostats_mostreputation<br />
</li>
<li>prostats_mostthanks<br />
</li>
<li>prostats_mostviews<br />
</li>
<li>prostats_newmembers<br />
</li>
<li>prostats_topdownloads<br />
</li>
<li>prostats_topposters<br />
</li>
<li>prostats_topreferrers<br />
</li>
<li>prostats_topthreadposters<br />
</li>
</ol>
<br />
3. Tương tự như bước 2, các bạn cũng tìm những templates sau đây và thay cái &lt;td&gt; thành <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>&lt;td class="hide"&gt;</code></div></div><ol type="1" class="mycode_list"><li>prostats_newestposts_date<br />
</li>
<li>prostats_newestposts_forum<br />
</li>
<li>prostats_newestposts_head_date<br />
</li>
<li>prostats_newestposts_head_forum<br />
</li>
<li>prostats_newestposts_head_starter<br />
</li>
<li>prostats_newestposts_starter<br />
</li>
</ol>
<br />
Vậy là xong rồi đó. Mọi người có thể thay đổi chỉnh sửa theo ý mình muốn. Joey đã test thử nhiều cách và thấy cách này là đẹp nhất cho responsive view. Khi nào rảnh Joey up lên vài tấm hình demo cho<br />
<br />
Enjoy<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=98" target="_blank" title="">Screenshot 2025-05-28 225010.png</a> (Kích thước: 223,38 KB / Tải về: 2)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=99" target="_blank" title="">Screenshot 2025-05-28 224951.png</a> (Kích thước: 156,69 KB / Tải về: 3)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=100" target="_blank" title="">Screenshot 2025-05-28 224840.png</a> (Kích thước: 148,84 KB / Tải về: 2)
<br />
<br />
<img src="https://congdong.mybb.vn/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
&nbsp;&nbsp;<a href="attachment.php?aid=101" target="_blank" title="">Screenshot 2025-05-28 224806.png</a> (Kích thước: 119,98 KB / Tải về: 3)
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Cài đặt và sử dụng Localhost cho người mới.]]></title>
			<link>https://congdong.mybb.vn/Thread-tutorial-cai-dat-va-su-dung-localhost-cho-nguoi-moi</link>
			<pubDate>Tue, 23 Jan 2024 10:42:52 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://congdong.mybb.vn/member.php?action=profile&uid=6">Tanthienlang</a>]]></dc:creator>
			<guid isPermaLink="false">https://congdong.mybb.vn/Thread-tutorial-cai-dat-va-su-dung-localhost-cho-nguoi-moi</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">Localhost là gì?</span>Localhost là từ ghép của hai chữ “<span style="font-weight: bold;" class="mycode_b">local</span>” và “<span style="font-weight: bold;" class="mycode_b">host</span>“. Local dịch theo nghĩa IT là máy tính của bạn, Host theo nghĩa IT là máy chủ. Vậy localhost nghĩa là một máy chủ được vận hành trên máy tính của bạn.<br />
Localhost bao gồm nhiều ứng dụng đi kèm với nhau và tất cả các ứng dụng đó sẽ kết hợp với nhau để tạo ra một môi trường có thể chạy mã nguồn trang web ví dụ như Mybb.vn trên máy tính của chính bạn bao gồm:<ul class="mycode_list"><li>Phần mềm Webserver tên Apache, đây là webserver thông dụng nhất.<br />
</li>
<li>Phần mềm PHP để xử lý mã PHP vì WordPress viết bằng ngôn ngữ PHP.<br />
</li>
<li>Phần mềm MySQL Server để lưu trữ và xử lý cơ sở dữ liệu, do WordPress sử dụng MySQL làm nền tảng cơ sở dữ liệu. Cơ sở dữ liệu thường được mình viết theo chữ tiếng Anh là database.<br />
</li>
<li>Phần mềm PHPMyAdmin để xem và quản lý cơ sở dữ liệu MySQL.<br />
</li>
</ul>
Như vậy, đối chiếu với yêu cầu cơ bản của một diễn đàn mybb thì localhost đã hoàn toàn đáp ứng được.<br />
Localhost vận hành như thế nàoKhi cài đặt Localhost vào máy tính rồi, thì máy tính của bạn đã có một phần mềm Webserver để chạy ứng dụng website với địa chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://127.0.0.1" target="_blank" rel="noopener" class="mycode_url">http://127.0.0.1</a></span>. Đây là địa chỉ IP dạng localhost, ngoài ra bạn cũng có thể chạy localhost với đường dẫn là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span>.<br />
Thông thường khi cài Localhost, mỗi khi cần sử dụng bạn sẽ cần mở bảng điều khiển của localhost lên và kích hoạt cho nó khởi động các ứng dụng đi kèm.<br />
<span style="font-weight: bold;" class="mycode_b">Lưu ý trước khi cài đặt</span>Xoá toàn bộ ứng dụng liên quan tới localhostNếu bạn có cài đặt các phần mềm liên quan đến việc làm localhost như PHP, MySQL thì hãy xoá hết. Và bạn không nên cài XAMPP trên Windows Server đã cài đặt IIS.<br />
Lưu ý nếu bạn dùng SkypeNếu máy bạn đang cài đặt phần mềm Skype thì localhost sẽ không hoạt động được do Skype đã chiếm quyền sử dụng cổng mạng 80, đây là cổng mặc định của webserver. Do đó, bạn hãy mở <span style="font-weight: bold;" class="mycode_b">Skype -&gt; Tools -&gt; Connection Options -&gt;</span> và bỏ chọn phần “<span style="font-style: italic;" class="mycode_i">Use port 80 and 443…..</span>” rồi nhập một cổng bất kỳ để Skype sử dụng.<br />
 <br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg&quot; loading=&quot;lazy&quot;  width=&quot;796&quot; height=&quot;612&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-skype.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg" loading="lazy"  width="796" height="612" alt="[Hình ảnh: cai-dat-xampp-skype.jpg]" class="mycode_img" /></a><br />
Sửa xong, <span style="font-weight: bold;" class="mycode_b">hãy khởi động lại máy để hoàn tất</span>.<br />
Tắt tường lửaNếu máy bạn có cài đặt tường lửa từ Windows hay từ một phần mềm Antivirus nào khác thì hãy tắt nó đi vì có thể nó sẽ chặn cổng 80 hoặc các ứng dụng webserver.<br />
Tắt UAC trên WindowsNếu máy của bạn đang dùng Windows và có bật chức năng User Account Control thì hãy tắt nó đi khi dùng localhost để tránh các vấn đề bị giới hạn quyền.<br />
<a href="https://www.google.se/webhp?sourceid=chrome-instant&amp;rlz=1C1MSNA_viSE620SE620&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=t%e1%ba%aft%20uac" target="_blank" rel="noopener" class="mycode_url"><span style="font-style: italic;" class="mycode_i">Tìm cách tắt trên Google</span></a><br />
Hướng dẫn cài đặt LocalhostĐể cài Localhost chúng ta có rất nhiều cách và phần mềm, tuy nhiên nếu bạn là người mới thì mình khuyến khích các bạn dùng phần mềm <span style="font-weight: bold;" class="mycode_b">XAMPP</span> để cài localhost vì:<ul class="mycode_list"><li>XAMPP hoàn toàn miễn phí.<br />
</li>
<li>Dễ sử dụng.<br />
</li>
<li>Hỗ trợ các hệ điều hành thông dụng như Windows, Mac, Linux.<br />
</li>
</ul>
Tuy nhiên trong bài này mình chỉ hướng dẫn cho hệ điều hành Windows.<br />
Để tải XAMPP, đầu tiên bạn truy cập vào địa chỉ <a href="https://www.apachefriends.org/download.html" target="_blank" rel="noopener" class="mycode_url">https://www.apachefriends.org/download.html</a> và chọn phiên bản XAMPP phù hợp với hệ điều hành của máy tính bạn đang sử dụng, và bạn nên chọn phiên bản PHP 5.4.31. Lưu ý là XAMPP chỉ có phiên bản cho hệ điều hành 32bit nhưng 64bit vẫn hoạt động bình thường.<br />
Lưu ý: Hiện nay XAMPP đã ra bản mới hơn hỗ trợ MariaDB nhưng bị lỗi rất nhiều, bạn nên dùng phiên bản XAMPP 1.8.3 có thể tải <a href="http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.8.3/xampp-win32-1.8.3-5-VC11-installer.exe/download" target="_blank" rel="noopener" class="mycode_url">tại đây</a>. Nếu bạn dùng Mac thì tải <a href="http://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/1.8.3/xampp-osx-1.8.3-4-installer.dmg/download" target="_blank" rel="noopener" class="mycode_url">tại đây</a>.<br />
Sau khi tải file cài đặt về xong, hãy chạy nó, sau đó chọn <span style="font-weight: bold;" class="mycode_b">Next</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;508&quot; height=&quot;428&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg" loading="lazy"  width="508" height="428" alt="[Hình ảnh: cai-dat-xampp-01.jpg]" class="mycode_img" /></a><br />
Ở phần chọn đường dẫn, bạn hãy chọn đường dẫn cần lưu cài đặt của XAMPP. Lưu ý rằng đường dẫn này bạn phải nhớ vì khi cài đặt web lên localhost, bạn phải truy cập vào thư mục này. Bạn nên để mặc định là <span style="font-weight: bold;" class="mycode_b">c:\xampp</span>. Tiếp tục ấn Next.<br />
<br />
Ở trang kế tiếp, bạn bỏ chọn phần “<span style="font-style: italic;" class="mycode_i">Learn more about Bitnami for XAMPP</span>“. Và ấn Next 2 lần nữa để bắt đầu quá trình cài đặt XAMPP.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg&quot; loading=&quot;lazy&quot;  width=&quot;515&quot; height=&quot;425&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-04.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg" loading="lazy"  width="515" height="425" alt="[Hình ảnh: cai-dat-xampp-04.jpg]" class="mycode_img" /></a><br />
Sau khi cài xong, ấn nút <span style="font-weight: bold;" class="mycode_b">Finish</span> để kết thúc cài đặt và mở bảng điều khiển của XAMPP. Tuy nhiên, hãy khởi động lại máy sau khi cài đặt xong để tránh tình trạng không khởi động được localhost.<br />
Khởi động LocalhostBây giờ bạn hãy vào thư mục <span style="font-weight: bold;" class="mycode_b">c:\xampp</span> và mở file<span style="font-weight: bold;" class="mycode_b"> xampp-panel.exe</span> lên để bật bảng điều khiển của XAMPP.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg&quot; loading=&quot;lazy&quot;  width=&quot;742&quot; height=&quot;475&quot; alt=&quot;[Hình ảnh: xampp-panel.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg" loading="lazy"  width="742" height="475" alt="[Hình ảnh: xampp-panel.jpg]" class="mycode_img" /></a>Bảng điều khiển của XAMPP<br />
Bạn để ý sẽ thấy hai ứng dụng Apache và MySQL có nút <span style="font-weight: bold;" class="mycode_b">Start</span>, đó là dấu hiệu bảo 2 ứng dụng này chưa được khởi động, hãy ấn vào nút Start của từng ứng dụng để khởi động Webserver Apache và MySQL Server lên thì mới chạy được localhost.<br />
Nếu cả hai ứng dụng chuyển sang màu xanh như hình dưới là đã khởi động thành công.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg&quot; loading=&quot;lazy&quot;  width=&quot;741&quot; height=&quot;474&quot; alt=&quot;[Hình ảnh: xampp-panel-start.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg" loading="lazy"  width="741" height="474" alt="[Hình ảnh: xampp-panel-start.jpg]" class="mycode_img" /></a><br />
Sau khi khởi động xong, bạn hãy truy cập vào website với địa chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span> sẽ thấy nó hiển thị ra trang giới thiệu XAMPP như hình dưới.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg&quot; loading=&quot;lazy&quot;  width=&quot;999&quot; height=&quot;544&quot; alt=&quot;[Hình ảnh: xampp-homepage.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg" loading="lazy"  width="999" height="544" alt="[Hình ảnh: xampp-homepage.jpg]" class="mycode_img" /></a><br />
Bạn có thể ấn vào nút <span style="font-weight: bold;" class="mycode_b">English</span> phía bên dưới để truy cập vào trang quản lý localhost.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg&quot; loading=&quot;lazy&quot;  width=&quot;995&quot; height=&quot;546&quot; alt=&quot;[Hình ảnh: xampp-manager-page.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg" loading="lazy"  width="995" height="546" alt="[Hình ảnh: xampp-manager-page.jpg]" class="mycode_img" /></a><br />
Tạm thời là thế, cách chi tiết cài đặt WordPress vào localhost XAMPP mình sẽ hướng dẫn ở phần sau.<br />
 Thao tác trên localhost1. Làm việc với thư mục và tập tinMột điều khá cơ bản nhưng rất quan trọng khi bạn làm việc với website mà bất kể là localhost hay hosting đó là hiểu cơ chế phân thư mục của WordPress.<br />
Bây giờ bạn hãy vào thư mục<span style="font-weight: bold;" class="mycode_b"> C:\xampp\htdocs\</span> và tạo một thư mục tên “<span style="font-weight: bold;" class="mycode_b">thachpham</span>“, thư mục này sẽ chứa website của mình.<br />
Như ở trên, mình đã hướng dẫn bạn tạo một thư mục tên là <span style="font-weight: bold;" class="mycode_b">thachpham</span> trong thư mục <span style="font-weight: bold;" class="mycode_b">htdocs</span> và bạn có thể sử dụng đường dẫn <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham</code></div></div> để chạy. Vậy bây giờ mình có thể nói, thư mục <span style="font-weight: bold;" class="mycode_b">C:\xampp\htdocs\thachpham</span>chính là thư mục gốc của tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/thachpham" target="_blank" rel="noopener" class="mycode_url">http://localhost/thachpham</a></span><br />
Bây giờ bạn thử copy một tập tin nào đó vào trong thư mục <span style="font-weight: bold;" class="mycode_b">C:\xampp\htdocs\thachpham r</span>ồi chạy tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/thachpham" target="_blank" rel="noopener" class="mycode_url">http://localhost/thachpham</a></span>, bạn sẽ thấy nó liệt kê file mà bạn vừa copy vào.<br />
Nếu bạn click vào file ảnh đó thì trình duyệt sẽ hiển thị ảnh với đường dẫn là <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham/tên-tập-tin</code></div></div>. Đây được xem là một link ảnh trong website của bạn.<br />
Tương tự, hãy thử tạo một thư mục bất kỳ rồi copy một tập tin nào đó vào, thì bây giờ bạn có thể truy cập xem ảnh với đường dẫn là <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham/tên-folder/tên-tập-tin</code></div></div>.<br />
Như vậy bạn có thể hiểu, cái đường dẫn trên website nó sẽ phân thứ cấp tùy theo cấu trúc thư mục và file trong đó.<br />
2. Tạo cơ sở dữ liệu MySQL (Database)Thao tác này bạn sẽ phải làm trong bước cài đặt WordPress trên localhost nhưng ở đây mình sẽ hướng dẫn trước để bạn có thể làm thử luôn.<br />
Khi nhắc đến database, bạn phải nhớ là nó bao gồm 3 thành phần chính là:<ul class="mycode_list"><li>Tên user của database.<br />
</li>
<li>Mật khẩu của user database.<br />
</li>
<li>Tên database.<br />
</li>
<li>Database Host (thường thì điền là <span style="font-weight: bold;" class="mycode_b">localhost</span>, bất kể là bạn dùng ở localhost hay host bình thường).<br />
</li>
</ul>
Bạn hãy tưởng tượng rằng, user của database sẽ có nhiệm vụ đọc và ghi dữ liệu vào database nên khi sử dụng các mã nguồn PHP, bạn phải khai báo cùng lúc cả user của database và tên database.<br />
Đối với localhost, bạn không cần tạo user cho database mà sẽ sử dụng thông tin user như sau:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Tên user database</span>: root<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mật khẩu:</span> bỏ trống<br />
</li>
</ul>
Do vậy, chúng ta chỉ cần tạo database là đủ.<br />
Để tạo database, bạn hãy truy cập vào localhost với đường dẫn <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/phpmyadmin" target="_blank" rel="noopener" class="mycode_url">http://localhost/phpmyadmin</a></span>. Sau đó bạn nhấp vào menu <span style="font-weight: bold;" class="mycode_b">Databases</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;1000&quot; height=&quot;546&quot; alt=&quot;[Hình ảnh: localhost-tao-database-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg" loading="lazy"  width="1000" height="546" alt="[Hình ảnh: localhost-tao-database-01.jpg]" class="mycode_img" /></a><br />
Sau đó ở phần Create databsae, bạn nhập tên database cần tạo vào ô Database name, phần Collation bạn hãy chọn là <span style="font-weight: bold;" class="mycode_b">utf8_unicode_ci</span> như hình dưới rồi ấn nút <span style="font-weight: bold;" class="mycode_b">Create</span> kế bên.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg&quot; loading=&quot;lazy&quot;  width=&quot;634&quot; height=&quot;222&quot; alt=&quot;[Hình ảnh: localhost-tao-database-02.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg" loading="lazy"  width="634" height="222" alt="[Hình ảnh: localhost-tao-database-02.jpg]" class="mycode_img" /></a><br />
Tạo xong hãy nhìn bên menu tay trái, nếu nó xuất hiện tên database vừa tạo là thành công. Vậy bây giờ, chúng ta tạm có một databse với các thông tin như:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Database Host</span>: localhost<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database user</span>: root<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database password</span>: trống<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database name</span>: thachphamblog<br />
</li>
</ul>
Còn cách sử dụng với nó như thế nào thì mình sẽ nói ở bước <a href="https://thachpham.com/wordpress/wordpress-tutorials/cai-wordpress-localhost-xampp.html" target="_blank" rel="noopener" class="mycode_url">cài WordPress trên localhost</a> cho thực tế.<br />
Tới đây bạn đã có một cái localhost sử dụng địa chỉ dạng <a href="http://localhost/" target="_blank" rel="noopener" class="mycode_url">http://localhost/</a> hoặc <a href="http://127.0.0.1/" target="_blank" rel="noopener" class="mycode_url">http://127.0.0.1/</a> rồi. Nếu bạn đã rành việc sử dụng localhost và cần thêm tên miền ảo thì ấn qua trang 2 để tiếp tục xem phần nâng cao. Lưu ý là <span style="font-weight: bold;" class="mycode_b">không dành cho người mới.</span><br />
Cách đổi cổng mạng cho LocalhostMặc định Localhost sẽ sử dụng cổng 80, bởi vì khi bạn gõ tên miền như <a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a> thì tức là nó đã sử dụng cổng 80 để đọc các dữ liệu web trong localhost. Tuy nhiên nếu như bạn đã dùng cổng 80 cho một ứng dụng khác, hoặc đơn giản là không khởi động Apache được thì bạn nên thiết lập cho Apache trong Localhost sử dụng một cổng khác, như 8080 chẳng hạn.<br />
Trước khi đổi, mình cần các bạn lưu ý là sau khi đổi xong thì bạn phải truy cập vào website với tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost:8080" target="_blank" rel="noopener" class="mycode_url">http://localhost:8080</a></span> thay vì chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span>.<br />
Để đổi cổng, bạn mở bảng điều khiển XAMPP lên và chọn nút Config của Apache, sau đó chọn<span style="font-weight: bold;" class="mycode_b"> Apache (httpd.conf)</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;796&quot; height=&quot;477&quot; alt=&quot;[Hình ảnh: doi-port-localhost-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg" loading="lazy"  width="796" height="477" alt="[Hình ảnh: doi-port-localhost-01.jpg]" class="mycode_img" /></a><br />
Sau đó bạn tìm dòng này:<br />
Listen 80Đổi thành<br />
Listen 8080Sau đó bạn Stop cái Apache và Start lại rồi thử truy cập vào localhost theo đường dẫn <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost:8080" target="_blank" rel="noopener" class="mycode_url">http://localhost:8080</a></span>, nếu truy cập được thì bạn đã làm thành công. Và cũng nên lưu ý rằng, sau khi đổi cổng thì mỗi khi truy cập bạn phải sử dụng đường dẫn có kèm theo số cổng bạn vừa đổi sang vì mặc định nếu không điền thì nó sẽ sử dụng cổng 80.<br />
Nếu bạn có sử dụng tên miền ảo như mình hướng dẫn ở trên thì bạn cũng nên sửa lại file <span style="font-weight: bold;" class="mycode_b">C:\xampp\apache\conf\extra\httpd-vhost.conf</span> cho nó sử dụng port 80 thay vì 8080.<br />
Một số câu hỏi liên quan đến localhost<span style="font-weight: bold;" class="mycode_b">Tôi có thể gửi cho bạn bè tôi xem website ở localhost không?</span><br />
<span style="font-style: italic;" class="mycode_i">Không, thân ái.</span><br />
<span style="font-weight: bold;" class="mycode_b">Sau này tôi có thể chuyển dữ liệu từ localhost lên host trên Internet không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hoàn toàn được.</span><br />
<span style="font-weight: bold;" class="mycode_b">Localhost có bị chậm không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hầu như không, trừ khi máy bạn quá yếu.</span><br />
<span style="font-weight: bold;" class="mycode_b">Localhost có bị hack website không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hầu như không nếu máy tính của bạn không bị truy cập bởi một người nào khác.</span><br />
<span style="font-weight: bold;" class="mycode_b">Lời kết</span>Ở trên là toàn bộ những gì bạn cần biết về localhost và nó sẽ đi theo bạn trong suốt quá trình làm việc với website vì host chỉ nên sử dụng để chạy website chính trên internet, còn localhost bạn nên dùng để thử nghiệm hoặc cần chỉnh sửa cái gì đó trong website mà không muốn nó ảnh hưởng trực tiếp đến website chính<br />
(Bài viết trên blog Thachpham)]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">Localhost là gì?</span>Localhost là từ ghép của hai chữ “<span style="font-weight: bold;" class="mycode_b">local</span>” và “<span style="font-weight: bold;" class="mycode_b">host</span>“. Local dịch theo nghĩa IT là máy tính của bạn, Host theo nghĩa IT là máy chủ. Vậy localhost nghĩa là một máy chủ được vận hành trên máy tính của bạn.<br />
Localhost bao gồm nhiều ứng dụng đi kèm với nhau và tất cả các ứng dụng đó sẽ kết hợp với nhau để tạo ra một môi trường có thể chạy mã nguồn trang web ví dụ như Mybb.vn trên máy tính của chính bạn bao gồm:<ul class="mycode_list"><li>Phần mềm Webserver tên Apache, đây là webserver thông dụng nhất.<br />
</li>
<li>Phần mềm PHP để xử lý mã PHP vì WordPress viết bằng ngôn ngữ PHP.<br />
</li>
<li>Phần mềm MySQL Server để lưu trữ và xử lý cơ sở dữ liệu, do WordPress sử dụng MySQL làm nền tảng cơ sở dữ liệu. Cơ sở dữ liệu thường được mình viết theo chữ tiếng Anh là database.<br />
</li>
<li>Phần mềm PHPMyAdmin để xem và quản lý cơ sở dữ liệu MySQL.<br />
</li>
</ul>
Như vậy, đối chiếu với yêu cầu cơ bản của một diễn đàn mybb thì localhost đã hoàn toàn đáp ứng được.<br />
Localhost vận hành như thế nàoKhi cài đặt Localhost vào máy tính rồi, thì máy tính của bạn đã có một phần mềm Webserver để chạy ứng dụng website với địa chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://127.0.0.1" target="_blank" rel="noopener" class="mycode_url">http://127.0.0.1</a></span>. Đây là địa chỉ IP dạng localhost, ngoài ra bạn cũng có thể chạy localhost với đường dẫn là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span>.<br />
Thông thường khi cài Localhost, mỗi khi cần sử dụng bạn sẽ cần mở bảng điều khiển của localhost lên và kích hoạt cho nó khởi động các ứng dụng đi kèm.<br />
<span style="font-weight: bold;" class="mycode_b">Lưu ý trước khi cài đặt</span>Xoá toàn bộ ứng dụng liên quan tới localhostNếu bạn có cài đặt các phần mềm liên quan đến việc làm localhost như PHP, MySQL thì hãy xoá hết. Và bạn không nên cài XAMPP trên Windows Server đã cài đặt IIS.<br />
Lưu ý nếu bạn dùng SkypeNếu máy bạn đang cài đặt phần mềm Skype thì localhost sẽ không hoạt động được do Skype đã chiếm quyền sử dụng cổng mạng 80, đây là cổng mặc định của webserver. Do đó, bạn hãy mở <span style="font-weight: bold;" class="mycode_b">Skype -&gt; Tools -&gt; Connection Options -&gt;</span> và bỏ chọn phần “<span style="font-style: italic;" class="mycode_i">Use port 80 and 443…..</span>” rồi nhập một cổng bất kỳ để Skype sử dụng.<br />
 <br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg&quot; loading=&quot;lazy&quot;  width=&quot;796&quot; height=&quot;612&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-skype.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-skype.jpg" loading="lazy"  width="796" height="612" alt="[Hình ảnh: cai-dat-xampp-skype.jpg]" class="mycode_img" /></a><br />
Sửa xong, <span style="font-weight: bold;" class="mycode_b">hãy khởi động lại máy để hoàn tất</span>.<br />
Tắt tường lửaNếu máy bạn có cài đặt tường lửa từ Windows hay từ một phần mềm Antivirus nào khác thì hãy tắt nó đi vì có thể nó sẽ chặn cổng 80 hoặc các ứng dụng webserver.<br />
Tắt UAC trên WindowsNếu máy của bạn đang dùng Windows và có bật chức năng User Account Control thì hãy tắt nó đi khi dùng localhost để tránh các vấn đề bị giới hạn quyền.<br />
<a href="https://www.google.se/webhp?sourceid=chrome-instant&amp;rlz=1C1MSNA_viSE620SE620&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=t%e1%ba%aft%20uac" target="_blank" rel="noopener" class="mycode_url"><span style="font-style: italic;" class="mycode_i">Tìm cách tắt trên Google</span></a><br />
Hướng dẫn cài đặt LocalhostĐể cài Localhost chúng ta có rất nhiều cách và phần mềm, tuy nhiên nếu bạn là người mới thì mình khuyến khích các bạn dùng phần mềm <span style="font-weight: bold;" class="mycode_b">XAMPP</span> để cài localhost vì:<ul class="mycode_list"><li>XAMPP hoàn toàn miễn phí.<br />
</li>
<li>Dễ sử dụng.<br />
</li>
<li>Hỗ trợ các hệ điều hành thông dụng như Windows, Mac, Linux.<br />
</li>
</ul>
Tuy nhiên trong bài này mình chỉ hướng dẫn cho hệ điều hành Windows.<br />
Để tải XAMPP, đầu tiên bạn truy cập vào địa chỉ <a href="https://www.apachefriends.org/download.html" target="_blank" rel="noopener" class="mycode_url">https://www.apachefriends.org/download.html</a> và chọn phiên bản XAMPP phù hợp với hệ điều hành của máy tính bạn đang sử dụng, và bạn nên chọn phiên bản PHP 5.4.31. Lưu ý là XAMPP chỉ có phiên bản cho hệ điều hành 32bit nhưng 64bit vẫn hoạt động bình thường.<br />
Lưu ý: Hiện nay XAMPP đã ra bản mới hơn hỗ trợ MariaDB nhưng bị lỗi rất nhiều, bạn nên dùng phiên bản XAMPP 1.8.3 có thể tải <a href="http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.8.3/xampp-win32-1.8.3-5-VC11-installer.exe/download" target="_blank" rel="noopener" class="mycode_url">tại đây</a>. Nếu bạn dùng Mac thì tải <a href="http://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/1.8.3/xampp-osx-1.8.3-4-installer.dmg/download" target="_blank" rel="noopener" class="mycode_url">tại đây</a>.<br />
Sau khi tải file cài đặt về xong, hãy chạy nó, sau đó chọn <span style="font-weight: bold;" class="mycode_b">Next</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;508&quot; height=&quot;428&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-01.jpg" loading="lazy"  width="508" height="428" alt="[Hình ảnh: cai-dat-xampp-01.jpg]" class="mycode_img" /></a><br />
Ở phần chọn đường dẫn, bạn hãy chọn đường dẫn cần lưu cài đặt của XAMPP. Lưu ý rằng đường dẫn này bạn phải nhớ vì khi cài đặt web lên localhost, bạn phải truy cập vào thư mục này. Bạn nên để mặc định là <span style="font-weight: bold;" class="mycode_b">c:\xampp</span>. Tiếp tục ấn Next.<br />
<br />
Ở trang kế tiếp, bạn bỏ chọn phần “<span style="font-style: italic;" class="mycode_i">Learn more about Bitnami for XAMPP</span>“. Và ấn Next 2 lần nữa để bắt đầu quá trình cài đặt XAMPP.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg&quot; loading=&quot;lazy&quot;  width=&quot;515&quot; height=&quot;425&quot; alt=&quot;[Hình ảnh: cai-dat-xampp-04.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/cai-dat-xampp-04.jpg" loading="lazy"  width="515" height="425" alt="[Hình ảnh: cai-dat-xampp-04.jpg]" class="mycode_img" /></a><br />
Sau khi cài xong, ấn nút <span style="font-weight: bold;" class="mycode_b">Finish</span> để kết thúc cài đặt và mở bảng điều khiển của XAMPP. Tuy nhiên, hãy khởi động lại máy sau khi cài đặt xong để tránh tình trạng không khởi động được localhost.<br />
Khởi động LocalhostBây giờ bạn hãy vào thư mục <span style="font-weight: bold;" class="mycode_b">c:\xampp</span> và mở file<span style="font-weight: bold;" class="mycode_b"> xampp-panel.exe</span> lên để bật bảng điều khiển của XAMPP.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg&quot; loading=&quot;lazy&quot;  width=&quot;742&quot; height=&quot;475&quot; alt=&quot;[Hình ảnh: xampp-panel.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel.jpg" loading="lazy"  width="742" height="475" alt="[Hình ảnh: xampp-panel.jpg]" class="mycode_img" /></a>Bảng điều khiển của XAMPP<br />
Bạn để ý sẽ thấy hai ứng dụng Apache và MySQL có nút <span style="font-weight: bold;" class="mycode_b">Start</span>, đó là dấu hiệu bảo 2 ứng dụng này chưa được khởi động, hãy ấn vào nút Start của từng ứng dụng để khởi động Webserver Apache và MySQL Server lên thì mới chạy được localhost.<br />
Nếu cả hai ứng dụng chuyển sang màu xanh như hình dưới là đã khởi động thành công.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg&quot; loading=&quot;lazy&quot;  width=&quot;741&quot; height=&quot;474&quot; alt=&quot;[Hình ảnh: xampp-panel-start.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-panel-start.jpg" loading="lazy"  width="741" height="474" alt="[Hình ảnh: xampp-panel-start.jpg]" class="mycode_img" /></a><br />
Sau khi khởi động xong, bạn hãy truy cập vào website với địa chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span> sẽ thấy nó hiển thị ra trang giới thiệu XAMPP như hình dưới.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg&quot; loading=&quot;lazy&quot;  width=&quot;999&quot; height=&quot;544&quot; alt=&quot;[Hình ảnh: xampp-homepage.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-homepage.jpg" loading="lazy"  width="999" height="544" alt="[Hình ảnh: xampp-homepage.jpg]" class="mycode_img" /></a><br />
Bạn có thể ấn vào nút <span style="font-weight: bold;" class="mycode_b">English</span> phía bên dưới để truy cập vào trang quản lý localhost.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg&quot; loading=&quot;lazy&quot;  width=&quot;995&quot; height=&quot;546&quot; alt=&quot;[Hình ảnh: xampp-manager-page.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/xampp-manager-page.jpg" loading="lazy"  width="995" height="546" alt="[Hình ảnh: xampp-manager-page.jpg]" class="mycode_img" /></a><br />
Tạm thời là thế, cách chi tiết cài đặt WordPress vào localhost XAMPP mình sẽ hướng dẫn ở phần sau.<br />
 Thao tác trên localhost1. Làm việc với thư mục và tập tinMột điều khá cơ bản nhưng rất quan trọng khi bạn làm việc với website mà bất kể là localhost hay hosting đó là hiểu cơ chế phân thư mục của WordPress.<br />
Bây giờ bạn hãy vào thư mục<span style="font-weight: bold;" class="mycode_b"> C:\xampp\htdocs\</span> và tạo một thư mục tên “<span style="font-weight: bold;" class="mycode_b">thachpham</span>“, thư mục này sẽ chứa website của mình.<br />
Như ở trên, mình đã hướng dẫn bạn tạo một thư mục tên là <span style="font-weight: bold;" class="mycode_b">thachpham</span> trong thư mục <span style="font-weight: bold;" class="mycode_b">htdocs</span> và bạn có thể sử dụng đường dẫn <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham</code></div></div> để chạy. Vậy bây giờ mình có thể nói, thư mục <span style="font-weight: bold;" class="mycode_b">C:\xampp\htdocs\thachpham</span>chính là thư mục gốc của tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/thachpham" target="_blank" rel="noopener" class="mycode_url">http://localhost/thachpham</a></span><br />
Bây giờ bạn thử copy một tập tin nào đó vào trong thư mục <span style="font-weight: bold;" class="mycode_b">C:\xampp\htdocs\thachpham r</span>ồi chạy tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/thachpham" target="_blank" rel="noopener" class="mycode_url">http://localhost/thachpham</a></span>, bạn sẽ thấy nó liệt kê file mà bạn vừa copy vào.<br />
Nếu bạn click vào file ảnh đó thì trình duyệt sẽ hiển thị ảnh với đường dẫn là <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham/tên-tập-tin</code></div></div>. Đây được xem là một link ảnh trong website của bạn.<br />
Tương tự, hãy thử tạo một thư mục bất kỳ rồi copy một tập tin nào đó vào, thì bây giờ bạn có thể truy cập xem ảnh với đường dẫn là <br />
 <br />
<div class="codeblock"><div class="title">Code:&nbsp;<button class="copyButton"></button></div><div class="body textToCopy" dir="ltr"><code>http://localhost/thachpham/tên-folder/tên-tập-tin</code></div></div>.<br />
Như vậy bạn có thể hiểu, cái đường dẫn trên website nó sẽ phân thứ cấp tùy theo cấu trúc thư mục và file trong đó.<br />
2. Tạo cơ sở dữ liệu MySQL (Database)Thao tác này bạn sẽ phải làm trong bước cài đặt WordPress trên localhost nhưng ở đây mình sẽ hướng dẫn trước để bạn có thể làm thử luôn.<br />
Khi nhắc đến database, bạn phải nhớ là nó bao gồm 3 thành phần chính là:<ul class="mycode_list"><li>Tên user của database.<br />
</li>
<li>Mật khẩu của user database.<br />
</li>
<li>Tên database.<br />
</li>
<li>Database Host (thường thì điền là <span style="font-weight: bold;" class="mycode_b">localhost</span>, bất kể là bạn dùng ở localhost hay host bình thường).<br />
</li>
</ul>
Bạn hãy tưởng tượng rằng, user của database sẽ có nhiệm vụ đọc và ghi dữ liệu vào database nên khi sử dụng các mã nguồn PHP, bạn phải khai báo cùng lúc cả user của database và tên database.<br />
Đối với localhost, bạn không cần tạo user cho database mà sẽ sử dụng thông tin user như sau:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Tên user database</span>: root<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mật khẩu:</span> bỏ trống<br />
</li>
</ul>
Do vậy, chúng ta chỉ cần tạo database là đủ.<br />
Để tạo database, bạn hãy truy cập vào localhost với đường dẫn <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost/phpmyadmin" target="_blank" rel="noopener" class="mycode_url">http://localhost/phpmyadmin</a></span>. Sau đó bạn nhấp vào menu <span style="font-weight: bold;" class="mycode_b">Databases</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;1000&quot; height=&quot;546&quot; alt=&quot;[Hình ảnh: localhost-tao-database-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-01.jpg" loading="lazy"  width="1000" height="546" alt="[Hình ảnh: localhost-tao-database-01.jpg]" class="mycode_img" /></a><br />
Sau đó ở phần Create databsae, bạn nhập tên database cần tạo vào ô Database name, phần Collation bạn hãy chọn là <span style="font-weight: bold;" class="mycode_b">utf8_unicode_ci</span> như hình dưới rồi ấn nút <span style="font-weight: bold;" class="mycode_b">Create</span> kế bên.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg&quot; loading=&quot;lazy&quot;  width=&quot;634&quot; height=&quot;222&quot; alt=&quot;[Hình ảnh: localhost-tao-database-02.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/localhost-tao-database-02.jpg" loading="lazy"  width="634" height="222" alt="[Hình ảnh: localhost-tao-database-02.jpg]" class="mycode_img" /></a><br />
Tạo xong hãy nhìn bên menu tay trái, nếu nó xuất hiện tên database vừa tạo là thành công. Vậy bây giờ, chúng ta tạm có một databse với các thông tin như:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Database Host</span>: localhost<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database user</span>: root<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database password</span>: trống<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Database name</span>: thachphamblog<br />
</li>
</ul>
Còn cách sử dụng với nó như thế nào thì mình sẽ nói ở bước <a href="https://thachpham.com/wordpress/wordpress-tutorials/cai-wordpress-localhost-xampp.html" target="_blank" rel="noopener" class="mycode_url">cài WordPress trên localhost</a> cho thực tế.<br />
Tới đây bạn đã có một cái localhost sử dụng địa chỉ dạng <a href="http://localhost/" target="_blank" rel="noopener" class="mycode_url">http://localhost/</a> hoặc <a href="http://127.0.0.1/" target="_blank" rel="noopener" class="mycode_url">http://127.0.0.1/</a> rồi. Nếu bạn đã rành việc sử dụng localhost và cần thêm tên miền ảo thì ấn qua trang 2 để tiếp tục xem phần nâng cao. Lưu ý là <span style="font-weight: bold;" class="mycode_b">không dành cho người mới.</span><br />
Cách đổi cổng mạng cho LocalhostMặc định Localhost sẽ sử dụng cổng 80, bởi vì khi bạn gõ tên miền như <a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a> thì tức là nó đã sử dụng cổng 80 để đọc các dữ liệu web trong localhost. Tuy nhiên nếu như bạn đã dùng cổng 80 cho một ứng dụng khác, hoặc đơn giản là không khởi động Apache được thì bạn nên thiết lập cho Apache trong Localhost sử dụng một cổng khác, như 8080 chẳng hạn.<br />
Trước khi đổi, mình cần các bạn lưu ý là sau khi đổi xong thì bạn phải truy cập vào website với tên miền <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost:8080" target="_blank" rel="noopener" class="mycode_url">http://localhost:8080</a></span> thay vì chỉ là <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a></span>.<br />
Để đổi cổng, bạn mở bảng điều khiển XAMPP lên và chọn nút Config của Apache, sau đó chọn<span style="font-weight: bold;" class="mycode_b"> Apache (httpd.conf)</span>.<br />
<a href="https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg" target="_blank" rel="noopener" class="mycode_url" data-fancybox="data-201" data-type="image" data-caption="&lt;img src=&quot;https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg&quot; loading=&quot;lazy&quot;  width=&quot;796&quot; height=&quot;477&quot; alt=&quot;[Hình ảnh: doi-port-localhost-01.jpg]&quot; class=&quot;mycode_img&quot; /&gt;"><img src="https://thachpham.com/wp-content/uploads/2013/09/doi-port-localhost-01.jpg" loading="lazy"  width="796" height="477" alt="[Hình ảnh: doi-port-localhost-01.jpg]" class="mycode_img" /></a><br />
Sau đó bạn tìm dòng này:<br />
Listen 80Đổi thành<br />
Listen 8080Sau đó bạn Stop cái Apache và Start lại rồi thử truy cập vào localhost theo đường dẫn <span style="font-weight: bold;" class="mycode_b"><a href="http://localhost:8080" target="_blank" rel="noopener" class="mycode_url">http://localhost:8080</a></span>, nếu truy cập được thì bạn đã làm thành công. Và cũng nên lưu ý rằng, sau khi đổi cổng thì mỗi khi truy cập bạn phải sử dụng đường dẫn có kèm theo số cổng bạn vừa đổi sang vì mặc định nếu không điền thì nó sẽ sử dụng cổng 80.<br />
Nếu bạn có sử dụng tên miền ảo như mình hướng dẫn ở trên thì bạn cũng nên sửa lại file <span style="font-weight: bold;" class="mycode_b">C:\xampp\apache\conf\extra\httpd-vhost.conf</span> cho nó sử dụng port 80 thay vì 8080.<br />
Một số câu hỏi liên quan đến localhost<span style="font-weight: bold;" class="mycode_b">Tôi có thể gửi cho bạn bè tôi xem website ở localhost không?</span><br />
<span style="font-style: italic;" class="mycode_i">Không, thân ái.</span><br />
<span style="font-weight: bold;" class="mycode_b">Sau này tôi có thể chuyển dữ liệu từ localhost lên host trên Internet không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hoàn toàn được.</span><br />
<span style="font-weight: bold;" class="mycode_b">Localhost có bị chậm không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hầu như không, trừ khi máy bạn quá yếu.</span><br />
<span style="font-weight: bold;" class="mycode_b">Localhost có bị hack website không?</span><br />
<span style="font-style: italic;" class="mycode_i">Hầu như không nếu máy tính của bạn không bị truy cập bởi một người nào khác.</span><br />
<span style="font-weight: bold;" class="mycode_b">Lời kết</span>Ở trên là toàn bộ những gì bạn cần biết về localhost và nó sẽ đi theo bạn trong suốt quá trình làm việc với website vì host chỉ nên sử dụng để chạy website chính trên internet, còn localhost bạn nên dùng để thử nghiệm hoặc cần chỉnh sửa cái gì đó trong website mà không muốn nó ảnh hưởng trực tiếp đến website chính<br />
(Bài viết trên blog Thachpham)]]></content:encoded>
		</item>
	</channel>
</rss>