What Is Drupal?
สรุปง่ายๆคือ เป็นระบบจัดการเนื้อหาบนเว็บแต่ต่างจาก CMS ตัวอื่นๆคือ มีรูปที่เป็น Framework มากขึ้น
Core
- ใน Drupal จะมี Function, Module หลักอยู่แล้ว รวมถึง Code ที่เรียกใช้งาน Library ของ Function ที่ใช้ร่วมกันบ่อยๆ เช่น User Management, Taxonomy, Template
Modules
- Drupal เป็น Module Framework ดังนั้น Function ต่างๆจะถูกรวมใน Module ซึ่งสามารถ Enabled / Disabled ได้ (แต่บาง Module ที่จำเป็นไม่สามารถ Disabled ได้)
Hooks
- ดเหมือนเป็นเหตุการณ์ข้างในของ Drupal (เรียกว่า Callbacks)
- มี Function ตามชื่อ เช่น comment_user() ใน comment Module, locale_user() ใน locale module, node_user() ใน node module
- อ่านเพิ่มเติมได้ที่ Drupal
Themes
-
*
Nodes
- ประเภทของ Content ใน Drupal ถูกอ้างอิงเป็น node (ทั้ง Blog, Project Task)
Blocks
- ข้อมูลของ Block สามารถเปิด/ปิด ได้บนหน้าเว็บไซต์
- ใน Block อาจจะจุข้อมูลผู้ใช้ที่กำลังใช้งาน ซึ่งวางได้ใน sidebar, header, หรือ footer ของ Template
File Layout
ตามลำดับโครงสร้างของ File มีดังนี้
- files : สำหรับเก็บ logo, avatars, หรือ File Upload อื่นๆ
- includes : เก็บ Library ของ Function ของ Drupal
- module : เก็บ Module หลัก (สามารถใส่ Extra Module ใน sites)
- misc : เก็บ JavaScript และ icons, images ในการติดตั้ง Drupal
- profiles : เก็บ Profile ในการติดตั้งที่แตกต่างของ Drupal เช่น E-Commerce Profile จะติดตั้ง Drupal อัตโนมัติในรูปแบบของ E-Commerce
- scripts : สำหรับตรวจสอบ syntax, cleaning up code, และจัดการ Special Case กับ cron รวมถึงมี script shell และ perl บางส่วน
- sites : Folder สำหรับใส่การปรับปรุง Drupal ของผู้ใช้
- all : เก็บ Modules และ Themes
- default : เก็บ default configuration
- [custom] : เก็บ configuration ของเว็บ (copy file มาจาก default) เช่น sites/example.com/settings.php
- themes : เก็บพวก template engine และ default themes
Serving a Request
The Web Server’s Role
- .htaccess : สำหรับทำ Clean URLs (แปลงจาก index.php?q=foo/bar เป็น /foo/bar เรียกว่า Drupal Path)
- ถ้า Apache ต้อง Enable Mod_rewrite ก่อน แต่ถ้าเป็น IIS ต้องใช้ ISAPI_Rewrite
The Bootstrap Process
ทุก HTTP Request จะผ่านเฟสที่ชื่อว่า Bootstrap (อยู่ใน bootstrap.inc) รายละเอียดมีตามนี้
- Configuration
- Early Page Cache
- Database
- Access
- Session
- Late Page Cache
- Path
- Full
Processing a Request
ยกตัวอย่างเช่น http://example.com/q=node/3 URL ถูก Map ไปยัง Funciton node_page_view() ใน node.module นอกจากนี้ Process จะรับข้อมูลเพื่อ Node จาก Database และวางมันเข้าไปใน Data Stucture หลังจากนั้นถึงเวลา Theming
Theming the Data
เกี่ยวกับการเปลี่ยนข้อมูลที่ถูกรับ, ถูกจัดการ หรือถูกสร้างใน HTML Drupal และใช้ Theme ตามที่ Admin เลือกให้แสดงผลลัพธ์

Post new comment