echo

ผมไปเจอโค้ด echo <<< EOF ตัวนี้ตอนกำลังเขียน plugin ใช้กับ wordpress อยู่คับ เห็นแล้วอึ้งไปเลย เขียนโค้ดให้มันง่าย ๆ แบบนี้ได้ด้วยเหรอเนี้ย เหอ ๆๆ ที่ผ่านมานะคับ ก็จะประมาณนี้

<?
echo "
<div><br/>To use My API Key:
<ol>
<li>Visit <a target=’_blank’ href=’http://www.mysite.com’>registration page</a>.
<li>Enter Your Details</li>
<li>Submit</li>
<li>Copy the displayed API Key and Secret into this form.</li>
<li>Recommended: </li>
</ol>
<hr/>
";
?>

โค้ดข้างบนนี้ เวลาผมจะใส่ html ลงใน php ก็ใช้วิธีนี้คับ แต่ทว่า ต้องระว่างเรื่อง ' และ " อย่างมาก

ดูโค้ดตัวอย่างกันคับ ผมไม่ต้องกังวลเกี่ยวกับ ' และ " อีกต่อไปแล้ว มันจะไม่มากวนใจผมไปอีกนานเลย 55555+

<?
echo <<<EOF
<div><br/>To use My API Key:
<ol>
<li>Visit <a target="_blank" href="http://www.mysite.com">registration page</a>.
<li>Enter Your Details</li>
<li>Submit</li>
<li>Copy the displayed API Key and Secret into this form.</li>
<li>Recommended: </li>
</ol>
<hr/>
EOF;
?>

วิธีเอาไปใช้ง่าย ๆ แค่
เปิดด้วย

echo <<<EOF

และ ปิดด้วย

EOF;
echo <<<EOF
<tag><html><code><here>
EOF;

Programming Cheat Sheet PDF

Cheat Sheet เหล่านี้ ต้นฉบับมาจาก http://blog.nihilogic.dk/ นะคับ

css cheat sheet v1.pdf
http://www.upload.tc/download/69504/css-cheat-sheet-v1.pdf.html

css cheat sheet v2.pdf
http://www.upload.tc/download/69505/css_cheat-sheet_v2.pdf.html

html5 canvas cheat sheet.pdf
http://www.upload.tc/download/69506/html5_canvas_cheat_sheet.pdf.html

html character entities cheat sheet.pdf
http://www.upload.tc/download/69508/html-character-entities-cheat-sheet.pdf.html

html cheat sheet v1.pdf
http://www.upload.tc/download/69509/html-cheat-sheet-v1.pdf.html

html entities cheat sheet v3.pdf
http://www.upload.tc/download/69517/html_entities_cheatsheet_v3.pdf.html

html colors cheat sheet v2.pdf
http://www.upload.tc/download/69507/html_colors_cheatsheet_v2.pdf.html

javascript dom cheat sheet.pdf
http://www.upload.tc/download/69516/javascript-dom-cheatsheet.pdf.html

javascript cheat sheet v1.pdf
http://www.upload.tc/download/69515/javascript-cheat-sheet-v1.pdf.html

jquery cheat sheet 1.2.pdf
http://www.upload.tc/download/69521/jquery-cheat-sheet-1.2.pdf.html

jquery cheat sheet 1.3.pdf
http://www.upload.tc/download/69524/jquery_1.3_cheatsheet_v1.pdf.html

mod rewrite cheat sheet v2
http://www.upload.tc/download/69523/mod_rewrite-cheat-sheet-v2.pdf.html

mootools 12 cheat sheet.pdf
http://www.upload.tc/download/69525/mootools-12-cheat-sheet.pdf.html

mootools 12 cheat sheet pf.pdf
http://www.upload.tc/download/69522/mootools-12-cheat-sheet-pf.pdf.html

prototype 1.5.0 snookca.pdf
http://www.upload.tc/download/69536/prototype_1.5.0_snookca.pdf.html

prototype 1.6.0.2 cheat sheet.pdf
http://www.upload.tc/download/69532/prototype_cheatsheet_1.6.0.2.pdf.html

php cheat sheet v2.pdf
http://www.upload.tc/download/69535/php-cheat-sheet-v2.pdf.html

regula expression cheat sheet v1.pdf
http://www.upload.tc/download/69534/regular-expressions-cheat-sheet-v1.pdf.html

regular expression cheat sheet v2.pdf
http://www.upload.tc/download/69529/regular-expressions-cheat-sheet-v2.pdf.html

mysql cheat sheet v1.pdf
http://www.upload.tc/download/69530/mysql-cheat-sheet-v1.pdf.html

rgb hex cheat sheet v1.pdf
http://www.upload.tc/download/69531/rgb-hex-cheat-sheet-v1.pdf.html

xhtml 1.1 cheat sheet v3.pdf
http://www.upload.tc/download/69533/xhtml_1.1_cheatsheet_v3.pdf.html

แกะไพล์ zip หรือ rar ด้วย php

คราวนี้เราจะมา แกะไพล์ zip หรือว่าไพล์ rar ด้วย php กันคับ

เรื่องของเรื่องคือว่า ผมต้องการจะอับไพล์ joomla ขึ้นไปติดตั้งบน server เพื่อทำระบบจัดการเว็บให้เค้าใหม่ แต่ว่า host ที่ผมกำลังจะทำเนี้ย เค้าไม่มี ftp มาให้ เหอะ ๆ เอาล่ะสิ แล้วจะทำเว็บไงว่ะเนี้ย โชคยังดี ในระบบเก่า มันมีตัว upload ไพล์ ขึ้นบน server แต่ก็นะ อับได้ที่ล่ะไพล์ ไพล์ของ joomla มีเป็นร้อย จะให้มานั่งอับไพล์กันที่ละไพล์ กว่าจะเสร็จ ตาเหลือกกันพอดี โชคยังดีอีกเช่นเคย เคยใช้ระบบ file manager แบบไพล์เดียวมาก่อน ก็เลยไปรื้อ script เก่า ๆ ที่เขียนไว้สมัยหนุ่ม ๆ เอามาใช้ใหม่ แล้วก็ได้ผลดีซะด้วย เอิ๊ก ๆๆ

สิ่งที่ผมจะทำนะคับ
ผมต้องการติดตั้ง joomla ในระบบ

สิ่งที่ผมไม่มี
ผมไม่มี ftp account

สิ่งที่ผมมีอยู่
บางส่วนของระบบเดิม ที่อับไพล์ขึ้นได้ที่ล่ะไพล์ แล้วก็ลงลึกไปหลายโพล์เดอร์เลย (ลงลึกไปหลายโพลเดอร์ ยังไงน่ะเหรอ ก็แบบนี้คับ htdocs/xxxxx/wsyings/span/fileupload)

สิ่งที่ผมทำ
1. ผมสร้างระบบ file manager แบบไพล์เดียวขึ้นมา จัดการไพล์บนระบบ (สร้าง folder ลบไพล์บางไพล์ออกไป)
2. ผมอับไพล์ joomla.zip ขึ้นระบบ ด้วย file manager ที่สร้างขึ้นมาสด ๆ ร้อน
3. ผมเขียน script เพิ่มใน file manager ให้มันแกะไพล์ zip หรือว่า rar ได้

งานนี้ไม่ต้องง้อคนดูและระบบคับ ถึงไม่มี ftp ให้ เราก็ยังติดตั้งระบบได้คับ 55555+

(
บางคนอาจจะสงสัย แล้วเอา username กับ password ของ mysql มาจากไหน ระบบเก่ามีให้เหรอ

ตอบว่า…ไม่มีคับ….เขียน script ไพล์ อับโหลด + file manager ได้เองซะขนาดนั้น pass ก็หาเอาในระบบสิคับ เอา file manager วิ่งไปซะทั่วเลยอ่ะ 555555+
)

แล้วจะเอาไพล์ joomla ไปติดตั้งยังไง ???
ผ่านฟูง bug มาในระดับนี้แล้วคับ วิธีของผมก็คือ
1. เขียนไพล์ upload ขึ้นมา เพื่ออับไพล์ joomla.zip ขึ้น host
2. เขียนไพล์ php ให้มันแกะไพล์ joomla.zip ให้มันแกะใส่ folder ที่เราต้องการ แล้วก็ติดตั้ง joomla เข้าระบบ

เด๋วเอาไพล์ php มาให้ดูอีกทีนะคับ ตอนนี้ขอไปนอนก่อนล่ะ เช้าแล้ว….ฮ้าาาว…ง่วง

Get Adobe Flash playerPlugin by wpburn.com wordpress themes