<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>นพ ภิญโญวาณิชกะ &#187; PHP</title>
	<atom:link href="http://www.nop.in.th/category/programming/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nop.in.th</link>
	<description>Nop Pinyowanichaka &#124; ก้าวสั้นๆ ในวันเบาๆ ของผม</description>
	<lastBuildDate>Wed, 14 Jul 2010 01:54:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>เริ่มต้นง่ายๆ กับการเขียน WordPress Plugins บทที่ 1</title>
		<link>http://www.nop.in.th/programming/php/%e0%b9%80%e0%b8%a3%e0%b8%b4%e0%b9%88%e0%b8%a1%e0%b8%95%e0%b9%89%e0%b8%99%e0%b8%87%e0%b9%88%e0%b8%b2%e0%b8%a2%e0%b9%86-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5/</link>
		<comments>http://www.nop.in.th/programming/php/%e0%b9%80%e0%b8%a3%e0%b8%b4%e0%b9%88%e0%b8%a1%e0%b8%95%e0%b9%89%e0%b8%99%e0%b8%87%e0%b9%88%e0%b8%b2%e0%b8%a2%e0%b9%86-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 06:14:50 +0000</pubDate>
		<dc:creator>นพ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tutor]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.nop.in.th/chit-chat/get-start-your-own-wordpress-plugins/</guid>
		<description><![CDATA[เริ่มต้นง่ายๆ กับการเขียน WordPress Plugin บทที่ 1 ว่าจะลองเขียน Plugin ของ WordPress หลายต่อหลายครั้งแล้ว แต่ยังไม่ได้เริ่มเลยสักครั้ง คราวนี้ฤกษ์งามยามดีเพราะว่าต้องทำ Theme ให้ www.iamewery.com แล้วต้องไปแก้ Plugins หลายๆอันเพื่อให้สวยงามพอดีกับ Theme และยังอยากเขียน Plugins ที่สำหรับ ใส่ตัวเก็บสถิติของ Stats.in.th ด้วย (โปรเจ็คถัดไป) วันนี้เลยเอาวิธีเขียน Plugins แบบ ง่ายมาเขียนให้ดูกันครับ ในบทที่ 1 นี้เราจะเริ่มเขียน Plugin ง่ายๆตัวนึง โดยตั้งชื่อว่า WP-ColorClock หน้าที่ของปลั๊กอินอันนี้คือการแสดงวันที่ปัจจุบันในทุกๆ Post ด้วยอักษรสีแดง ให้ทำการสร้าง File ชื่อ wp-colorclock.php ไว้ใน wp-content/plugins จากนั้นเข้าไปแก้ไขไฟล์นี้ด้วย Notepad หรือ Editor อื่นๆตามถนัด &#60;?php /* Plugin [...]]]></description>
			<content:encoded><![CDATA[<p><strong>เริ่มต้นง่ายๆ กับการเขียน WordPress Plugin บทที่ 1</strong></p>
<p>ว่าจะลองเขียน Plugin ของ WordPress หลายต่อหลายครั้งแล้ว แต่ยังไม่ได้เริ่มเลยสักครั้ง คราวนี้ฤกษ์งามยามดีเพราะว่าต้องทำ Theme ให้ <a href="http://www.iamewery.com/blog" target="_blank">www.iamewery.com</a> แล้วต้องไปแก้ Plugins หลายๆอันเพื่อให้สวยงามพอดีกับ Theme และยังอยากเขียน Plugins ที่สำหรับ ใส่ตัวเก็บสถิติของ Stats.in.th ด้วย (โปรเจ็คถัดไป) วันนี้เลยเอาวิธีเขียน Plugins แบบ ง่ายมาเขียนให้ดูกันครับ</p>
<p>ในบทที่ 1 นี้เราจะเริ่มเขียน Plugin ง่ายๆตัวนึง โดยตั้งชื่อว่า WP-ColorClock  หน้าที่ของปลั๊กอินอันนี้คือการแสดงวันที่ปัจจุบันในทุกๆ Post ด้วยอักษรสีแดง</p>
<p>ให้ทำการสร้าง File ชื่อ wp-colorclock.php ไว้ใน wp-content/plugins จากนั้นเข้าไปแก้ไขไฟล์นี้ด้วย Notepad หรือ Editor อื่นๆตามถนัด</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: WP-ColorClock
Version: 0.1
Description: Plugin Description
Author: Plugin Author Name
Author URI:  Author website url
Plugin URI: Plugins website url
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><span id="more-635"></span></p>
<p>แล้วก็ Save จากนั้นเราลอง Login เข้าไปที่ Admin Panel ใน Menu Plugins &gt; Installed จะเห็นหน้าจอดังภาพ</p>
<p><img style="max-width: 800px;" src="http://www.nop.in.th/wp-content/uploads/2009/08/plugins-me2.jpg" alt="" /></p>
<p>แต่พอเรา Click Ativate ก็จะไม่เกิดอะไรขึ้นเพราะเรายังไม่ได้เขียนอะไร เรามา เริ่ม Step ถัดไปกัน</p>
<p>เรามาเพิ่ม function showColorClock ใน Plugin ไฟล์ตัวนี้</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> showColorClock<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parse_content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$parse_content</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;p&gt; &lt;font color=red&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$a</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/font&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>โดยไปเรียก Function พื้นฐานของ WordPress คือ current_time(&#8216;mysql&#8217;) ก็คือ เอาเวลาปัจจุบันแบบ style mysql มาเข้าตัวแปร $a นั่นเอง<br />
จากนั้น function ก็คืนค่า $parse_content ก็คือเนื้อหาของ Post นั้น  กลับไปพร้อม เวลาในตัวแปร $a</p>
<p>จากนั้นก็จำการแทรกในแต่ละ Post ด้วยคำัสั่ง</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'showColorClock'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>คำสั่ง add_filter เป็น function ในการแทรก Function ต่อจาก &#8216;the_content&#8217; นั่นก็คือ เนื้อความของ Post นั่นเอง</p>
<p>หน้าตาของ Post ก็จะเป็นแบบนี้ครับ</p>
<p><img style="max-width: 800px;" src="http://www.nop.in.th/wp-content/uploads/2009/08/plugins-me.jpg" alt="" /></p>
<p>สำหรับ Plugins ง่ายๆของ WordPress ก็เขียนได้ประการฉะนี้</p>
<p>จบการวิธีการเขียน WordPress Plugins บทที่ 1 ครับ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nop.in.th/programming/php/%e0%b9%80%e0%b8%a3%e0%b8%b4%e0%b9%88%e0%b8%a1%e0%b8%95%e0%b9%89%e0%b8%99%e0%b8%87%e0%b9%88%e0%b8%b2%e0%b8%a2%e0%b9%86-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Codeigniter Activerecord กับ MSSQL แล้ว Error</title>
		<link>http://www.nop.in.th/programming/php/codeigniter-activerecord-%e0%b8%81%e0%b8%b1%e0%b8%9a-mssql-%e0%b9%81%e0%b8%a5%e0%b9%89%e0%b8%a7-error/</link>
		<comments>http://www.nop.in.th/programming/php/codeigniter-activerecord-%e0%b8%81%e0%b8%b1%e0%b8%9a-mssql-%e0%b9%81%e0%b8%a5%e0%b9%89%e0%b8%a7-error/#comments</comments>
		<pubDate>Thu, 22 May 2008 06:31:49 +0000</pubDate>
		<dc:creator>นพ</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nop.in.th/?p=259</guid>
		<description><![CDATA[เริ่มเอา Codeigniter ที่เป็น PHP Framework มาใช้งาน เนื่องจาก Learning Curve ต่ำๆ ของมัน ทำให้พอถูๆไถๆ ไปกับเค้าได้ แต่ผมว่ามันไม่ค่อย Smooth กับ MSSQL เอาเสียเลย เพราะ แม้ว่า Version ล่าสุดจะออกมาแล้วก็ตามยังไม่สามารถแก้ปัญหา การใช้ ActiveRecord กับ MSSQL ในการ Select ข้อมูลได้เลย สำหรับคนที่ีมีปัญหาเหมือนกัน ผมไปค้นเจอที่ Forum เลยเอามา Post ไ้ว้ จากที่นี่ $this-&#62;obj-&#62;db-&#62;select&#40;$filed_result&#41;; $this&#62;obj&#62;db&#62;where&#40;$filed_get,$keyword&#41;; $query = $this&#62;obj-&#62;db-&#62;get&#40;$table_get&#41;; ถ้า Select แบบนี้ละก็ Error อย่างไม่ทราบสาเหตุทันที ทั้งๆ ที่ Query ถูก ให้ไปแก้ไข database/drivers/mssql/mssql_driver.php บรรทัดที่ 461 จาก [...]]]></description>
			<content:encoded><![CDATA[<p>เริ่มเอา Codeigniter ที่เป็น PHP Framework มาใช้งาน เนื่องจาก Learning Curve ต่ำๆ ของมัน ทำให้พอถูๆไถๆ ไปกับเค้าได้ แต่ผมว่ามันไม่ค่อย Smooth กับ MSSQL เอาเสียเลย เพราะ แม้ว่า Version ล่าสุดจะออกมาแล้วก็ตามยังไม่สามารถแก้ปัญหา การใช้ ActiveRecord กับ MSSQL ในการ Select ข้อมูลได้เลย สำหรับคนที่ีมีปัญหาเหมือนกัน ผมไปค้นเจอที่ Forum เลยเอามา Post ไ้ว้ จากที่นี่</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filed_result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">&gt;</span>obj<span style="color: #339933;">&gt;</span>db<span style="color: #339933;">&gt;</span>where<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filed_get</span><span style="color: #339933;">,</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">&gt;</span>obj<span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_get</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>ถ้า Select แบบนี้ละก็ Error อย่างไม่ทราบสาเหตุทันที ทั้งๆ ที่ Query ถูก ให้ไปแก้ไข database/drivers/mssql/mssql_driver.php <strong>บรรทัดที่ 461</strong> จาก</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(^'</span><span style="color: #339933;">.</span><span style="color: #000088;">$lbound</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')([\w\d\-\_]+?)(\s|\)|$)/iS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'$1&quot;$2&quot;$3'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>เป็น</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(^'</span><span style="color: #339933;">.</span><span style="color: #000088;">$lbound</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')([\w\d\-\_]+?)(\s|\)|$)/iS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'$1$2$3'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>บรรทัดที่ 466 จาก</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">{$item}</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>เป็น</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$item}</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>ก็จะสามารถใช้งาน Activerecord ใน mssql ได้ครับ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nop.in.th/programming/php/codeigniter-activerecord-%e0%b8%81%e0%b8%b1%e0%b8%9a-mssql-%e0%b9%81%e0%b8%a5%e0%b9%89%e0%b8%a7-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ใช้ Pagination ใน Codeigniter กับ MSSQL</title>
		<link>http://www.nop.in.th/programming/php/pagination-with-codeigniter/</link>
		<comments>http://www.nop.in.th/programming/php/pagination-with-codeigniter/#comments</comments>
		<pubDate>Tue, 06 May 2008 12:15:18 +0000</pubDate>
		<dc:creator>นพ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[pagination]]></category>

		<guid isPermaLink="false">http://www.nop.in.th/?p=257</guid>
		<description><![CDATA[ใช้ Pagination ใน Codeigniter กับ ฐานข้อมูล Microsoft SQL (MSSQL) คือผมได้มีโอกาศลองใช้ Codeigniter กับ การเขียน โปรแกรมเรียกดูข้อมูลง่ายๆ จาก MSSQL แต่ติดปัญหาเรื่องการแบ่งหน้าด้วย Pagination ลองค้นๆ ดูใน Forum เค้าให้ไปแก้ไฟล์ \system\database\drivers\mssql\mssql_driver.php ตรงบรรทัด function _limit($sql, $limit, $offset) ให้เป็นแบบนี้ function _limit($sql, $limit, $offset) { // Horrible solucion =) //$i = $limit + $offset; //return preg_replace(&#8216;/(^\SELECT (DISTINCT)?)/i&#8217;,'\\1 TOP &#8216;.$i.&#8217; &#8216;, $sql); $cursorName = &#8216;mi_cursor_&#8217;.md5(strtolower($sql)); $sql = [...]]]></description>
			<content:encoded><![CDATA[<p>ใช้ Pagination ใน Codeigniter กับ ฐานข้อมูล Microsoft SQL (MSSQL)</p>
<p>คือผมได้มีโอกาศลองใช้ Codeigniter กับ การเขียน โปรแกรมเรียกดูข้อมูลง่ายๆ จาก MSSQL แต่ติดปัญหาเรื่องการแบ่งหน้าด้วย Pagination ลองค้นๆ ดูใน Forum เค้าให้ไปแก้ไฟล์</p>
<p>\system\database\drivers\mssql\mssql_driver.php</p>
<p>ตรงบรรทัด function _limit($sql, $limit, $offset) ให้เป็นแบบนี้</p>
<p>function _limit($sql, $limit, $offset)<br />
{<br />
// Horrible solucion =)<br />
//$i = $limit + $offset;<br />
//return preg_replace(&#8216;/(^\SELECT (DISTINCT)?)/i&#8217;,'\\1 TOP &#8216;.$i.&#8217; &#8216;, $sql);<br />
$cursorName = &#8216;mi_cursor_&#8217;.md5(strtolower($sql));<br />
$sql = &#8220;DECLARE &#8220;.$cursorName.&#8221; CURSOR DYNAMIC READ_ONLY FOR<br />
&#8220;.$sql.&#8221;<br />
OPEN &#8220;.$cursorName.&#8221;<br />
DECLARE @CURSOR AS INT<br />
SELECT @CURSOR = CURSOR_HANDLE FROM MASTER.DBO.SYSCURSORS<br />
WHERE CURSOR_NAME = &#8216;&#8221;.$cursorName.&#8221;&#8216;<br />
EXEC SP_CURSORFETCH @CURSOR, 32, &#8220;.($offset+1).&#8221;, &#8220;.$limit.&#8221;<br />
EXEC SP_CURSORCLOSE @CURSOR&#8221;;<br />
return $sql;<br />
}</p>
<p>ก็จะหายครับ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nop.in.th/programming/php/pagination-with-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot modify header information &#8211; headers already sent</title>
		<link>http://www.nop.in.th/programming/php/cannot-modify-header-information-headers-already-sent/</link>
		<comments>http://www.nop.in.th/programming/php/cannot-modify-header-information-headers-already-sent/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 04:05:03 +0000</pubDate>
		<dc:creator>นพ</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nop.in.th/?p=228</guid>
		<description><![CDATA[PHP มัน Error แบบนี้ Cannot modify header information &#8211; headers already sent แก้ยังไง มันมี 2 ทางแก้ครับ 1. แก้ที่ php.ini โดย แก้ บรรทัดที่ output_buffering จาก Off ให้เป็น On ซะoutput_buffering = On 2. override config ของ php ด้วย codeโดย ใส่ ob_start(); ไว้บนสุดของ Page ครับ]]></description>
			<content:encoded><![CDATA[<p>PHP มัน Error แบบนี้ </p>
<p><b>Cannot modify header information &#8211; headers already sent</b></p>
<p>แก้ยังไง</p>
<p><b>มันมี 2 ทางแก้ครับ </b></p>
<p><b>1. แก้ที่ php.ini </b><br />โดย แก้ บรรทัดที่ output_buffering จาก Off ให้เป็น On ซะ<br />output_buffering = On </p>
<p><b>2. override config ของ php ด้วย code</b><br />โดย ใส่ ob_start(); ไว้บนสุดของ Page ครับ </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nop.in.th/programming/php/cannot-modify-header-information-headers-already-sent/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>function makeurl($param)</title>
		<link>http://www.nop.in.th/programming/php/function-makeurlparam/</link>
		<comments>http://www.nop.in.th/programming/php/function-makeurlparam/#comments</comments>
		<pubDate>Sun, 01 Apr 2007 13:05:08 +0000</pubDate>
		<dc:creator>นพ</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nop.in.th/?p=35</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 9 10 11 12 13 function makeurl&#40;$param&#41; &#123; $replace=str_replace&#40;' ','-',$param&#41;; $replace=str_replace&#40;'&#38;amp;','and',$replace&#41;; $replace=str_replace&#40;'/','-',$replace&#41;; $replace=str_replace&#40;'(','',$replace&#41;; $replace=str_replace&#40;')','',$replace&#41;; $replace=str_replace&#40;'+','',$replace&#41;; $replace=str_replace&#40;'#','',$replace&#41;; $replace=str_replace&#40;&#34;'&#34;,'-',$replace&#41;; $replace=str_replace&#40;'&#34;','-',$replace&#41;; return $replace; &#125; จะเป็น function ในการ เปลี่ยน &#8211; &#8216; / ( ) # &#8216; &#8221; ให้เป็น &#8211; เพื่อให้เหมาะสมกับการค้นหาของ google]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> makeurl<span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;amp;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'and'</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'+'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$replace</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>จะเป็น function ในการ เปลี่ยน &#8211; &#8216; / ( ) # &#8216; &#8221; ให้เป็น &#8211; เพื่อให้เหมาะสมกับการค้นหาของ google</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nop.in.th/programming/php/function-makeurlparam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
