SMF Development > SMF Coding Discussion
วิธีติดแบนเนอร์โฆษณา (banner) ทั้งข้างบนและข้างล่าง อย่างง่ายๆ
changsunha:
ขอบคุณครับ กำลังหาพอดีเลยครับ
jim_no1:
--- อ้างจาก: КёngЯacing ที่ 30/09/06, 23:00:37 ---เนื่องจากมีหลายคนถามถึงวิธีติดแบนเนอร์ทั้งข้างบนและข้างล่าง ให้เหมือนกับเว็บ ThaiSMF
วิธีทำ มีดังนี้
ให้สร้างไฟล์ banner.txt แล้วจะใส่แบนเนอร์อะไรก็ตามใจ ก่อนใส่ก็ต้องมี จัดหน้ากลางแบบนี้ด้วย
--- โค้ด: ---<div align="center">โค้ด banner</div>
--- ปิดโค้ด ---
(ถ้าต้องการใส่ทั้งข้างบนและข้างล่าง ก็สร้างไฟล์ banner1.txt และ banner2.txt )
แล้วก็เอาไฟล์ banner.txt ไว้ที่เดียวกับ index.php ของฟอรั่ม (/forum/banner.txt)
เปิดไฟล์ Themes/default/index.template.php
ใส่แบนเนอร์ข้างบน
ค้นหา
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างล่างจากที่ค้นหา
--- โค้ด: ---include_once('banner1.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
include_once('banner1.txt');
// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';
--- ปิดโค้ด ---
ใส่แบนเนอร์ข้างล่าง
ค้นหา
--- โค้ด: --- // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างบนจากที่ค้นหา
--- โค้ด: ---include_once('banner2.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- </div>';
include_once('banner2.txt');
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
--- ปิดอ้างถึง ---
ต้องการถามอย่างนี้ครับว่า หน้า banner.txt นั้นให้เราสร้างใหม่ขึ้นมาแล้ว ในนั้น ให้เราใส่โค็ตเป็น html หรือ php ครับ ???
แล้วเมื่อเราร้องการปรับเปลี่ยน banner นั้นเมื่อเราทำการเปลี่ยนหน้านี้แล้ว จะมีการปรับเปลี่ยนอัตโนมัติเลยใช่หรือป่าวครับ ???
jim_no1:
--- อ้างจาก: КёngЯacing ที่ 30/09/06, 23:00:37 ---เนื่องจากมีหลายคนถามถึงวิธีติดแบนเนอร์ทั้งข้างบนและข้างล่าง ให้เหมือนกับเว็บ ThaiSMF
วิธีทำ มีดังนี้
ให้สร้างไฟล์ banner.txt แล้วจะใส่แบนเนอร์อะไรก็ตามใจ ก่อนใส่ก็ต้องมี จัดหน้ากลางแบบนี้ด้วย
--- โค้ด: ---<div align="center">โค้ด banner</div>
--- ปิดโค้ด ---
(ถ้าต้องการใส่ทั้งข้างบนและข้างล่าง ก็สร้างไฟล์ banner1.txt และ banner2.txt )
แล้วก็เอาไฟล์ banner.txt ไว้ที่เดียวกับ index.php ของฟอรั่ม (/forum/banner.txt)
เปิดไฟล์ Themes/default/index.template.php
ใส่แบนเนอร์ข้างบน
ค้นหา
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างล่างจากที่ค้นหา
--- โค้ด: ---include_once('banner1.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
include_once('banner1.txt');
// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';
--- ปิดโค้ด ---
ใส่แบนเนอร์ข้างล่าง
ค้นหา
--- โค้ด: --- // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างบนจากที่ค้นหา
--- โค้ด: ---include_once('banner2.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- </div>';
include_once('banner2.txt');
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
--- ปิดอ้างถึง ---
ต้องการถามอย่างนี้ครับว่า
หากหน้า banner.txt เนี่ย เรา้ต้องทำหน้าโค็ตนี้เป็น php หรือ html ครับ
jim_no1:
--- อ้างจาก: КёngЯacing ที่ 30/09/06, 23:00:37 ---เนื่องจากมีหลายคนถามถึงวิธีติดแบนเนอร์ทั้งข้างบนและข้างล่าง ให้เหมือนกับเว็บ ThaiSMF
วิธีทำ มีดังนี้
ให้สร้างไฟล์ banner.txt แล้วจะใส่แบนเนอร์อะไรก็ตามใจ ก่อนใส่ก็ต้องมี จัดหน้ากลางแบบนี้ด้วย
--- โค้ด: ---<div align="center">โค้ด banner</div>
--- ปิดโค้ด ---
(ถ้าต้องการใส่ทั้งข้างบนและข้างล่าง ก็สร้างไฟล์ banner1.txt และ banner2.txt )
แล้วก็เอาไฟล์ banner.txt ไว้ที่เดียวกับ index.php ของฟอรั่ม (/forum/banner.txt)
เปิดไฟล์ Themes/default/index.template.php
ใส่แบนเนอร์ข้างบน
ค้นหา
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างล่างจากที่ค้นหา
--- โค้ด: ---include_once('banner1.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- // Show the menu here, according to the menu sub template.
template_menu();
include_once('banner1.txt');
// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';
--- ปิดโค้ด ---
ใส่แบนเนอร์ข้างล่าง
ค้นหา
--- โค้ด: --- // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
แล้วก็เพิ่ม บรรทัดนี้ ข้างบนจากที่ค้นหา
--- โค้ด: ---include_once('banner2.txt');
--- ปิดโค้ด ---
เมื่อเสร็จแล้วก็จะเป็นแบบนี้
--- โค้ด: --- </div>';
include_once('banner2.txt');
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
--- ปิดโค้ด ---
--- ปิดอ้างถึง ---
ต้องการถามอย่างนี้ครับว่า
หากหน้า banner.txt เนี่ย เรา้ต้องทำหน้าโค็ตนี้เป็น php หรือ html ครับ
หรือพูดง่าย ๆ ก็คือว่าเราจะทำให้ banner.txt ออกมาให้มีหน้าตายังไงก็แล้วแต่เรา ไม่ทราบว่าผมเข้าใจถูกต้องหรือป่าวครับ
masterbant:
ครับ ตย. เช่น
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxx";
google_ad_slot = "7107308354";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<center>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_slot = "2865422465";
google_ad_width = 728;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
แล้วด้านล่างจะใส่ข้อความเพิ่ม หรือรูปแบบแล้วแต่เราครับ
นำร่อง
[0] ดัชนีข้อความ
[#] หน้าถัดไป
[*] หน้าที่แล้ว
ไปที่เวอร์ชันเต็ม