drupal

node

How to get the path of your theme

เวลาอยากจะดึง path ของ theme มาใช่เพื่อวัตถุประสงค์บางประการ เช่น link รูปหรืออะไรก็ตามแต่ ทำได้ดังนี้

ใช้งานใน template file (.tpl.php)
$directory สามารถใช้ได้ในทุก .tpl.php

ถ้าอยู่ใน module หรือ theme helper function
path_to_theme() จะให้ผลลัพธ์เดียวกับ $directory
base_path() จะให้ root url path ของ website

เสริมอีกเล็กน้อยถ้าอยากได้ Path ของฝั่ง Server ใช้นี่เลย !!
realpath(".").'/sites/'
ผลลัพธ์ /var/www/domain.com/sites/

drupal_get_path($type,$name) // use db
dirname(__FILE__); // for high performance doesn't touch any db

node

Render views in Drupal5, Drupal6

Render views in drupal5 (view2)

Render views in drupal6 (view2)

for feed reader please visit the my site. because source code was embed from Snipt