PhucSD
09-06-2011, 05:47 PM
Mod này sẽ thay thế thanh tìm kiếm mặc định của vbb trên navbar bằng công cụ tìm kiếm Google
Demo (http://vbbtesting.co.cc)
Bước 1: Tải file google.php (http://www.mediafire.com/?3r5aibgvqdba8tg)
Bước 2: Vào ACP => Styles & Templates => Style => Chọn style cần sửa => Add New Template .
Tile: GOOGLE
Teamplate: Dán đoạn code dưới đây vào
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle}</title>
{vb:raw headinclude}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<h2 class="blockhead">Google Custom Search</h2>
<div class="blockbody">
<div class="blockrow">
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 800;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
</div>
</div>
{vb:raw footer}
</body>
</html>
Save!
Bước 3: Chọn Edit Templates => Navigation / Breadcrumb Teamplates => navbar
Tìm:
<div id="globalsearch" class="globalsearch">
Và
<ul class="navbar_advanced_search">
Xóa hết code giữa 2 dòng đó và thay bằng
<form action="http://vbbtesting.co.cc/google.php" id="cse-search-box">
<input type="hidden" name="cx" value="partner-pub-xxxxxxx:xxxxxx-xxxxxx" />
<input type="hidden" name="cof" value="FORID:9" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<span class="textboxcontainer"><span><input type="text" value="" name="q" class="textbox" /></span></span>
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="sa" onclick="document.getElementById('navbar_search').submit;" /> </span></span>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
Lưu ý:
Thay cái link màu đỏ trong code trên bằng link chứa file google.php trên host của bạn
Thay partner-pub-xxxxxxx:xxxxxx-xxxxxx bằng code Adsense của bạn, nếu bạn không có tài khoản Adsense thì xóa hết dòng đó đi.
Demo (http://vbbtesting.co.cc)
Bước 1: Tải file google.php (http://www.mediafire.com/?3r5aibgvqdba8tg)
Bước 2: Vào ACP => Styles & Templates => Style => Chọn style cần sửa => Add New Template .
Tile: GOOGLE
Teamplate: Dán đoạn code dưới đây vào
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle}</title>
{vb:raw headinclude}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<h2 class="blockhead">Google Custom Search</h2>
<div class="blockbody">
<div class="blockrow">
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 800;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
</div>
</div>
{vb:raw footer}
</body>
</html>
Save!
Bước 3: Chọn Edit Templates => Navigation / Breadcrumb Teamplates => navbar
Tìm:
<div id="globalsearch" class="globalsearch">
Và
<ul class="navbar_advanced_search">
Xóa hết code giữa 2 dòng đó và thay bằng
<form action="http://vbbtesting.co.cc/google.php" id="cse-search-box">
<input type="hidden" name="cx" value="partner-pub-xxxxxxx:xxxxxx-xxxxxx" />
<input type="hidden" name="cof" value="FORID:9" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<span class="textboxcontainer"><span><input type="text" value="" name="q" class="textbox" /></span></span>
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="sa" onclick="document.getElementById('navbar_search').submit;" /> </span></span>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
Lưu ý:
Thay cái link màu đỏ trong code trên bằng link chứa file google.php trên host của bạn
Thay partner-pub-xxxxxxx:xxxxxx-xxxxxx bằng code Adsense của bạn, nếu bạn không có tài khoản Adsense thì xóa hết dòng đó đi.