ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: youcanberich ที่ 16 สิงหาคม 2008, 23:12:53



หัวข้อ: อยากจะลบ , ออกจากสตริงสุดท้าย และอยากเพิ่ม <td> ขั้นกลาง ขอแนวทางหน่อยครับ
เริ่มหัวข้อโดย: youcanberich ที่ 16 สิงหาคม 2008, 23:12:53
โค๊ด:
<?php
include("./datas/config.php");
$exclude = array("index.php");
$dir_links realpath("./");
$dir opendir($dir_links);
$files = array();
while ((
$file readdir($dir)) !== false) {
if (!in_array($file$exclude) && preg_match('/^(.+)\.php$/'$file$match)) {
        
$files[] = $file;
    }
}
closedir($dir);

shuffle($files);
for (
$i 0$count count($files); $i 15 && $i count($files); ++$i) {
    
$file $files[$i];
    
$nicename preg_replace('/(?<=.)([-])/'' 'substr($file0, -4));
    
$nicename ucwords($nicename);
    
$link $rooturl.$file;
    echo 
" &nbsp; <a href=\"".$link."\">$nicename</a>,";
}
?>
จากโค๊ต ผมสั่งให้สร้าง keyword มา 15คำ ที่นี้คำสุดท้ายมันจะมี , ติดมาด้วย ผมอยากลบออกจากคำสุดท้ายครับ
แล้วถ้าต้องการแทรก <td> เข้าไปทุกๆ keyword ที่5 ต้องเขียนโค๊ตประมาณไหนครับ (ผมเปิดหนังสือจนขาดเลย ยังทำไม่ได้ซักที  :-[)
ขอบคุณมากครับ


หัวข้อ: Re: อยากจะลบ , ออกจากสตริงสุดท้าย และอยากเพิ่ม <td> ขั้นกลาง ขอแนวทางหน่อยครับ
เริ่มหัวข้อโดย: ball6847 ที่ 17 สิงหาคม 2008, 00:17:21

จากโค๊ต ผมสั่งให้สร้าง keyword มา 15คำ ที่นี้คำสุดท้ายมันจะมี , ติดมาด้วย ผมอยากลบออกจากคำสุดท้ายครับ
แล้วถ้าต้องการแทรก <td> เข้าไปทุกๆ keyword ที่5 ต้องเขียนโค๊ตประมาณไหนครับ (ผมเปิดหนังสือจนขาดเลย ยังทำไม่ได้ซักที  :-[)
ขอบคุณมากครับ

อย่างงนี้ป่ะคับ งงๆ

โค๊ด:
<?php
include("./datas/config.php");
$exclude = array("index.php");
$dir_links realpath("./");
$dir opendir($dir_links);
$files = array();
while ((
$file readdir($dir)) !== false) {
if (!in_array($file$exclude) && preg_match('/^(.+)\.php$/'$file$match)) {
        
$files[] = $file;
    }
}
closedir($dir);

shuffle($files);
for (
$i 0$count count($files); $i 15 && $i count($files); ++$i) {
    
$file $files[$i];
    
$nicename preg_replace('/(?<=.)([-])/'' 'substr($file0, -4));
    
$nicename ucwords($nicename);
    
$link $rooturl.$file;
    
$link_array[] = "<a href=\"".$link."\">$nicename</a>";
}

echo 
implode(', ' $link_array);
?>


ไปอาบน้ำนอนล่ะคับ


หัวข้อ: Re: อยากจะลบ , ออกจากสตริงสุดท้าย และอยากเพิ่ม <td> ขั้นกลาง ขอแนวทางหน่อยครับ
เริ่มหัวข้อโดย: youcanberich ที่ 17 สิงหาคม 2008, 13:31:07
555 ผมงมอยู่ตั้งนาน ไปเขียนโค๊ตแปลงเป็น array อะไรไม่รู้อีรุงตุงนัง ไปหมดเลย คุณบอลแก้นิดเดียวจบเลย  :-[
ขอบคุณมากๆครับ
แต่ตอนนี้ยังติดอยู่อีกอันนึง ผมอยากให้แทรกโค๊ต <td> เข้าไปทุกๆคำที่ 5 แบบนี้เราจะเขียนโค๊ตยังไงครับ ยังนึกไม่ออกเลย หรือใครพอจะเคยเห็นโค๊ตแนวๆนี้ขอดูเป็นแนวทางหน่อยครับ


หัวข้อ: Re: อยากจะลบ , ออกจากสตริงสุดท้าย และอยากเพิ่ม <td> ขั้นกลาง ขอแนวทางหน่อยครับ
เริ่มหัวข้อโดย: ball6847 ที่ 17 สิงหาคม 2008, 14:03:48
555 ผมงมอยู่ตั้งนาน ไปเขียนโค๊ตแปลงเป็น array อะไรไม่รู้อีรุงตุงนัง ไปหมดเลย คุณบอลแก้นิดเดียวจบเลย  :-[
ขอบคุณมากๆครับ
แต่ตอนนี้ยังติดอยู่อีกอันนึง ผมอยากให้แทรกโค๊ต <td> เข้าไปทุกๆคำที่ 5 แบบนี้เราจะเขียนโค๊ตยังไงครับ ยังนึกไม่ออกเลย หรือใครพอจะเคยเห็นโค๊ตแนวๆนี้ขอดูเป็นแนวทางหน่อยครับ



โค๊ด:
<?php
include("./datas/config.php");
$exclude = array("index.php");
$dir_links realpath("./");
$dir opendir($dir_links);
$files = array();
while ((
$file readdir($dir)) !== false) {
if (!in_array($file$exclude) && preg_match('/^(.+)\.php$/'$file$match)) {
        
$files[] = $file;
    }
}
closedir($dir);

shuffle($files);
for (
$i 0$count count($files); $i 15 && $i count($files); ++$i) {
    
$file $files[$i];
    
$nicename preg_replace('/(?<=.)([-])/'' 'substr($file0, -4));
    
$nicename ucwords($nicename);
    
$link $rooturl.$file;
    
$link_array[] = ($i%== '<td>' '' ) . "<a href=\"".$link."\">$nicename</a>";
}

echo 
implode(', ' $link_array);
?>


น่าจะแบบนี้ ว่าแต่แทรกแค่ <td> จะพอหรอคับ ยังงัยเพิ่มเอานะคับ