มี pm ถามมา ผมขอตอบตรงนี้ละกัน (น้อยครั้งจะตอบในกระทู้ยกเว้นมันโครตยาว)
ในความหมาย หมายถึงสร้างไฟล์ php มารับค่าเพื่อแสดงผลแหละครับ
คือข้างบนผมบอกถึง
http://youyweb.com/out/index.php?site=
ก็คือ index.php นี้ เราก็เขียนรับค่ามาแสดงผล
อย่างสมมุตินะ (ยกตัวอย่างให้ดู)
ผมจะรับค่า แล้วเอาไปทำเป็นเฟรม
ก่อนอื่น ถ้าผมเขียนใช้จริง ตอนผมเขียนแปลง url อย่างข้างบนนั้น ผมจะใช้ urlencode ด้วย
urlencode กับ urldecode จะใช้คู่กันถือเข้าและออก
ใช้กันเพื่อเข้ารหัสให้้ค่าเหมาะแต่การถูกส่งข้อมูล
มันจะออกมาเป็น
$txtNews = "<a href=\"http://youyweb.com/out/index.php?site=" . urlencode($currItem->getLink()) . "\" target=\"". $this->target ."\" class=\"". $this->linkclass ."\">" .$currItem->getTitle() . "</a>";
ต่อมาในส่วนไฟล์ out/index.php ที่ผมจะมาแสดงผล
<?
//รับค่าลง $url
$url = urldecode($_GET['site']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>External Page</title>
</head>
<frameset rows="100%" cols="*" framespacing="0" frameborder="no" border="0">
<frame id="site" src="<?=url?>" />
</frameset>
<noframes><body>
Sorry... Your browser not support frameset. T-T
</body></noframes>
</html>
ประมาณแบบนี้ครับ
