- เครดิต
- 5095
- เพื่อน
- ทักทาย
- บล็อก
- อัลบั้ม
- โพสต์
- กระทู้
- แชร์
- สำคัญ
- สิทธิ์อ่าน
- 200
- จำนวนผู้ติดตาม
- จำนวนผู้กำลังติดตาม
- เพศ
- ไม่บอก
|
เป็นการเพิ่ม AdSense for search ใน Sidebar นะครับ
คำเตือน ทำด้วยความระมัดระวัง เนื่องจาก กฏของทาง Adsense ห้าทำการแก้ไขโค๊ดที่รับได้มา
1. คุณต้องมี accounts ของ adsense แล้วเข้าระบบ
ไปสร้าง AdSense for search แล้วรับโค๊ดมาเก็บไว้ก่อนครับ
2. เปิดไฟลล์ include/js/google.js
ค้นหาและลบออก
- document.writeln('<form name="gform" id="gform" method="get" action="http://www.google.com/search?" target="_blank" onSubmit="validate_google(this);">');
- document.writeln('<input type="hidden" name="client" value="aff-discuz" />');
- document.writeln('<input type="hidden" name="ie" value="' + google_charset + '" />');
- document.writeln('<input type="hidden" name="oe" value="UTF-8" />');
- document.writeln('<input type="hidden" name="hl" value="' + google_hl + '" />');
- document.writeln('<input type="hidden" name="lr" value="' + google_lr + '" />');
- document.writeln('<input type="hidden" name="channel" value="search" />');
- document.write('<div onclick="javascript:submitFormWithChannel(\'logo\')" style="cursor:pointer;float: left;width:70px;height:23px;background: url(images/common/Google_small.png) !important;background: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/common/Google_small.png\', sizingMethod=\'scale\')"><img src="images/common/none.gif" border="0" alt="Google" /></div>');
- document.writeln(' <input type="text" class="txt" size="20" name="q" id="q" maxlength="255" value=""></input>');
- document.writeln('<select name="site">');
- document.writeln('<option value="0"' + google_default_0 + '>Web Search</option>');
- document.writeln('<option value="1"' + google_default_1 + '>Search</option>');
- document.writeln('</select>');
- document.writeln(' <button type="submit" name="sa" value="true">Search</button>');
- document.writeln('</form>');
คัดลอกไปที่คลิปบอร์ด นำโค๊ดที่รับจาก adsense มาวางครับ
จากนั้นให้เพิ่มของโค๊ดที่นำมาวางใหม่
และปิดท้ายด้วยของโค๊ดที่นำมาวางใหม่
ทำการบันทึกแล้วอัพโหลดเพื่อใช้งานครับ
จากนั้นเปิดการทำงานค้นหาให้แสดงที่ sidebar ได้เลยครับ
หมายเหตุ : รูปแบบการแสดงผลใน Browser จะเป็นโค๊ดเดิมที่ได้รับมาจาก Adsense
ตัวอย่างที่ทำเสร็จแล้ว- document.writeln('<script type="text/javascript">');
- document.writeln('function validate_google(theform) {');
- document.writeln(' if(theform.site.value == 1) {');
- document.writeln(' theform.q.value = \'site:' + google_host + ' \' + theform.q.value;');
- document.writeln(' }');
- document.writeln('}');
- document.writeln('function submitFormWithChannel(channelname) {');
- document.writeln(' document.gform.channel.value=channelname;');
- document.writeln(' document.gform.submit();');
- document.writeln(' return;');
- document.writeln('}');
- document.writeln('</script>');
- document.writeln('<form action="http://www.google.com/cse" id="cse-search-box" target="_blank">');
- document.writeln(' <div>
- document.writeln(' <input type="hidden" name="cx" value="partner-pub-ของคุณ" />');
- document.writeln(' <input type="hidden" name="ie" value="UTF-8" />');
- document.writeln(' <input type="text" name="q" size="31" />');
- document.writeln(' <input type="submit" name="sa" value="Search" />');
- document.writeln(' </div>');
- document.writeln('</form>');
- document.writeln('<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>');
คัดลอกไปที่คลิปบอร์ด |
|
|
|
|
|
|