รบกวนถามอีกนิดนึงนะครับ คือโค้ดหน้า index ผมมันเป็นอย่างนี้อ่ะครับ ใช้ wordpress อ่ะคับ ผมอยากให้กระทู้ล่าสุดของบอร์ดมาแสดงผลหน้าแรกง่ะครับ
<?php if (is_archive()) $post_number = get_option('chameleon_archivenum_posts');
if (is_search()) $post_number = get_option('chameleon_searchnum_posts');
if (is_tag()) $post_number = get_option('chameleon_tagnum_posts');
if (is_category()) $post_number = get_option('chameleon_catnum_posts'); ?>
<?php get_header(); ?>
<?php include(TEMPLATEPATH . '/includes/breadcrumbs.php'); ?>
<?php include(TEMPLATEPATH . '/includes/top_info.php'); ?>
<div id="content" class="clearfix">
<div id="left-area">
<?php
global $query_string;
$i = 0;
if (is_category()) query_posts($query_string . "&showposts=$post_number&paged=$paged&cat=$cat");
else query_posts($query_string . "&showposts=$post_number&paged=$paged");
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
<?php endwhile; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<?php include(TEMPLATEPATH . '/includes/navigation.php'); ?>
<?php } ?>
<?php else : ?>
<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
<?php endif; wp_reset_query(); ?>
</div> <!-- end #left-area -->
<?php get_sidebar(); ?>
</div> <!-- end #content -->
<?php get_footer(); ?>
ทีนี้ผมก็ลองใส่โค้ดที่ดูจากกระทู้ที่ให้มา ไว้ต่อท้าย แบบนี้น่ะครับ
<?php if (is_archive()) $post_number = get_option('chameleon_archivenum_posts');
if (is_search()) $post_number = get_option('chameleon_searchnum_posts');
if (is_tag()) $post_number = get_option('chameleon_tagnum_posts');
if (is_category()) $post_number = get_option('chameleon_catnum_posts'); ?>
<?php get_header(); ?>
<?php include(TEMPLATEPATH . '/includes/breadcrumbs.php'); ?>
<?php include(TEMPLATEPATH . '/includes/top_info.php'); ?>
<div id="content" class="clearfix">
<div id="left-area">
<?php
global $query_string;
$i = 0;
if (is_category()) query_posts($query_string . "&showposts=$post_number&paged=$paged&cat=$cat");
else query_posts($query_string . "&showposts=$post_number&paged=$paged");
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
<?php endwhile; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<?php include(TEMPLATEPATH . '/includes/navigation.php'); ?>
<?php } ?>
<?php else : ?>
<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
<?php endif; wp_reset_query(); ?>
</div> <!-- end #left-area -->
<?php get_sidebar(); ?>
</div> <!-- end #content -->
<?php get_footer(); ?>
<?php
$connection = mysql_connect(localhost,"XXXXX"," YYYYY") or die("Service temporairly unavailable");
/* **XXXXX* : user ที่ใช้เข้าฐานข้อมูล YYYYY :/* pass ที่ใช้เข้าฐานข้อมูล */
$db = mysql_select_db("AAAAA",$connection) or die("Service temporairly unavailable"); /* AAAAA:ชื่อฐานข้อมูล */
$sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,7";
$cs1="set character_set_results=utf8";
mysql_query($cs1)or die('error query:'.mysql_error());
$cs2="set character_set_client=utf8";
mysql_query($cs2)or die('error query:'.mysql_error());
$cs3="set character_set_connection=utf8";
mysql_query($cs3)or die('error query:'.mysql_error());
$result = mysql_query($sql) or die("Service temporairly unavailable");
for($x=1;$x<=7;$x++){
$row = mysql_fetch_array($result);
echo "<img src=
http://www.xn--42cl7aoi1brr5b5a1c6kci8o ... otball.gif border=0 alt='Topic $tid'>\n"; /*พาร์ทของรูป*/
echo "<a href = \"
http://www.xn--42cl7aoi1brr5b5a1c6kci8o ... w[topic_id]\" target = \"_blank\">$row[topic_title]</a><br>"; /* BBBBB : โดเมนเว็บบอร์ดของคุณ*/
}
?>
แล้วก็ไปเปลี่ยนชื่อ user ,db name,pass โดเมนบอร์ดน่ะครับ ผลปรากฏว่าเข้าหน้าแรกเวบไม่ได้เลย เลยต้องทำกลับเป็นอันเดิมน่ะครับ ถึงจะแสดงผลหน้าแรกได้ตามปรกติ