ขอโค้ดที่ท่านแก้ไขล่าสุดได้ไหมครับ ผมทำไม่เป็น อิอิ
ไฟล์ BoardIndex.template.php ครับผม เวอร์ชั่น 2.0.11
แทรกไว้ก่อน ?>
function findIMG($text){
preg_match_all('/\[img\].*?\[\/img\]/i',$text,$page);
foreach($page as $value)
$src = substr($value[0],5);
$src = substr($src,0,-6);
return($src);
}
function ssi_pic($num_top = 12,$order,$board){
global $db_prefix, $scripturl, $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT t.id_topic,m.body,m.subject
FROM {db_prefix}messages m,{db_prefix}topics t
WHERE t.id_first_msg=m.id_msg AND t.id_board='.$board.'
ORDER BY t.'.$order.' DESC
LIMIT '.$num_top,
array(
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Build the array.
$topics[] = array(
'id' => $row['id_topic'],
'body' => $row['body'],
'subject' => $row['subject']
);
}
$smcFunc['db_free_result']($request);
foreach ($topics as $data){
$topic = "index.php?topic=".$data['id'].".0";
$srcPic = findIMG($data['body']);
$subject = $data['subject'];
if($srcPic ==''){
echo '<div class="boxpGal">
<div class="picpGal"><a href="'.$topic.'" title="'.$subject.'" target="_blank"><img src="http://เวปของคุณ/Themes/default/images/noimage.jpg" width="220" height="146" alt="" /><p>'.$subject.'</p></a></div>
</div>';
}else{
echo '<div class="boxpGal">
<div class="picpGal"><a href="'.$topic.'" title="'.$subject.'" target="_blank"><img src="'.$srcPic.'" width="220" height="146" alt="" /><p>'.$subject.'</p></a></div>
</div>';
}
}
}
ส่วนโค๊ดนี้ ไฟล์เดียวกันครับ แทรกไว้ตรงที่อยากจะแทรกครับ
echo'<div class="cat_bar">
<h3 class="catbg">สินค้า และ ร้านค้าใหม่ ล่าสุด</h3></div>';
echo''.ssi_pic(16,'ID_TOPIC',1.0).'';
16 คือรูปหรือโพสต์ที่อยากให้โชว์ในหน้าแรกครับ
ส่วน 1.0 .ให้แก้ไขตามคุณ SWOY ที่โพสต์ไว้ก่อนน่ะครับ (ผมยังไม่ได้ลองน่ะครับ ว่า ใช้ได้หรือไม่ครับ
และใน ไฟล์ index.css (ในธีมที่คุณใช้อยู่ครับ) ต่อท้ายเลยครับ
.boxpGal {
background-color: rgba(255, 255, 255, 0);
float: left;
height: 180;
width: 150px;
margin: 5px;
}