สอบถามเรื่อง Php code ค่ะ

By o

กำลังศึกษาการสร้าง Block กับ Php Code อยู่ค่ะ ตอนนี้ได้ทำการสร้าง Block โดยกำหนดให้ส่วนของ body เป็นข้อความ Php code ดังนี้ค่ะ
"<?php
$result = db_query_range(db_rewrite_sql("SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title,
node.created AS node_created,
users.name AS users_name,
users.uid AS users_uid
FROM node node
INNER JOIN users users ON node.uid = users.uid
WHERE (node.type in ('forum')) AND (node.vid IN (
SELECT tn.vid FROM term_node tn
LEFT JOIN term_hierarchy th ON th.tid = tn.tid
LEFT JOIN term_hierarchy th1 ON th.parent = th1.tid
LEFT JOIN term_hierarchy th2 ON th1.parent = th2.tid
LEFT JOIN term_hierarchy th3 ON th2.parent = th3.tid
WHERE tn.tid = 10
OR th1.tid = 10
OR th2.tid = 10
OR th3.tid = 10
))
GROUP BY nid
ORDER BY node_created DESC"), 10, 10);

if (db_num_rows($result)) {
$items = array();
while ($node = db_fetch_object($result)) {
$items[] = l($node->title, 'node/'. $node->nid) .' ('. l($node->name, 'user/'. $node->uid) .')';
}

echo theme('node_list', $items);
}

?>"
และกำหนด Input Format เป็น Php code แล้วบันทึก ผลปรากฎว่าระบบ Hang ไปซะเฉยๆ
ไม่ทราบว่าต้องแก้ไขอย่างไรถึงจะใช้ php code ได้
ขอบคุณค่ะ

2 comments

รูปภาพของ ball.in.th
By ball.in.th
1 ปี 36 weeks ago

ถ้าจะเขียน php

ถ้าจะเขียน php น่าจะทำเป็นโมดูลมากกว่าป่าว?
ถ้าเล็กๆน้อยๆ ใช้ Views ก็น่าจะได้ครับ
ถ้ายังจะทำแบบเดิม น่าจะลองแบบง่ายๆก่อนครับ เช่น
<?php
echo "hello world";
?>

สำหรับปัญหา เดาว่า syntax ไม่ถูกต้องครับ

รูปภาพของ maxasus123
By maxasus123
1 ปี 34 weeks ago

จะให้มันแสดงผลมาแบบไหนอ่ะครับ

จะให้มันแสดงผลมาแบบไหนอ่ะครับผม ว่าใช้ views ทำง่ายว่านะครับผม