Methods summary
public
static
|
#
add( array $array )
ฟังก์ชั่นกำหนดค่าตัวแปรของ template
ฟังก์ชั่นนี้จะแทนที่ตัวแปรที่ส่งทั้งหมดลงใน template ทันที.
ฟังก์ชั่นกำหนดค่าตัวแปรของ template
ฟังก์ชั่นนี้จะแทนที่ตัวแปรที่ส่งทั้งหมดลงใน template ทันที.
Parameters
- $array
- ชื่อที่ปรากฏใน template รูปแบบ array(key1=>val1,key2=>val2)
Returns
static
|
public static
static
|
#
create( string $owner, string $module, string $name )
โหลด template
ครั้งแรกจะตรวจสอบไฟล์จาก module ถ้าไม่พบ จะใช้ไฟล์จาก owner.
โหลด template
ครั้งแรกจะตรวจสอบไฟล์จาก module ถ้าไม่พบ จะใช้ไฟล์จาก owner.
Parameters
- $owner
- ชื่อโมดูลที่ติดตั้ง
- $module
- ชื่อโมดูล
- $name
- ชื่อ template ไม่ต้องระบุนามสกุลของไฟล์
Returns
static
Assert
('', '', 'FileNotFound')->isEmpty() [==] true
|
public static
static
|
#
createFromFile( string $filename )
โหลด template จากไฟล์.
Parameters
Returns
static
Throws
Assert
('FileNotFound') [throws] InvalidArgumentException
|
public static
static
|
#
createFromHTML( string $html )
สร้าง template จาก HTML.
Parameters
Returns
static
|
public static
string
|
#
get( )
คืนค่าไดเร็คทอรี่ของ template ตั้งแต่ DOCUMENT_ROOT เช่น skin/default/.
คืนค่าไดเร็คทอรี่ของ template ตั้งแต่ DOCUMENT_ROOT เช่น skin/default/.
Returns
string
|
public
boolean
|
#
hasItem( )
ฟังก์ชั่นตรวจสอบว่ามีการ add ข้อมูลมาหรือเปล่า
คืนค่า true ถ้ามีการเรียกใช้คำสั่ง add มาก่อนหน้า, หรือ false ถ้าไม่ใช่.
ฟังก์ชั่นตรวจสอบว่ามีการ add ข้อมูลมาหรือเปล่า
คืนค่า true ถ้ามีการเรียกใช้คำสั่ง add มาก่อนหน้า, หรือ false ถ้าไม่ใช่.
Returns
boolean
|
public static
|
#
init( string $skin )
กำหนด template ที่ต้องการ.
กำหนด template ที่ต้องการ.
Parameters
- $skin
- ไดเร็คทอรี่ของ template ตั้งแต่ DOCUMENT_ROOT ไม่ต้องมี / ปิดท้าย เช่น skin/default
|
public
static
|
#
insertHTML( string $html )
ฟังก์ชั่นใส่ HTML ลงใน template ตรงๆ
ใช้สำหรับแทรก HTML ลงระหว่างแต่ละรายการ.
ฟังก์ชั่นใส่ HTML ลงใน template ตรงๆ
ใช้สำหรับแทรก HTML ลงระหว่างแต่ละรายการ.
Parameters
Returns
static
|
public
boolean
|
#
isEmpty( )
ตรวจสอบว่ามีไฟล์ Template ถูกเลือกหรือไม่
คืนค่า true ถ้าไม่พบไฟล์ Template หรือ Template ว่างเปล่า, อื่นๆคืนค่า False.
ตรวจสอบว่ามีไฟล์ Template ถูกเลือกหรือไม่
คืนค่า true ถ้าไม่พบไฟล์ Template หรือ Template ว่างเปล่า, อื่นๆคืนค่า False.
Returns
boolean
|
public static
string
|
#
load( string $owner, string $module, string $name )
โหลด template
ครั้งแรกจะตรวจสอบไฟล์จาก $module ถ้าไม่พบ จะใช้ไฟล์จาก $owner
ถ้าไม่พบคืนค่าว่าง.
โหลด template
ครั้งแรกจะตรวจสอบไฟล์จาก $module ถ้าไม่พบ จะใช้ไฟล์จาก $owner
ถ้าไม่พบคืนค่าว่าง.
Parameters
- $owner
- ชื่อโมดูลที่ติดตั้ง
- $module
- ชื่อโมดูลที่ลงทะเบียน
- $name
- ชื่อ template ไม่ต้องระบุนามสกุลของไฟล์
Returns
string
|
public static
string
|
#
pregReplace( array $patt, array $replace, string $skin )
ฟังก์ชั่น preg_replace รองรับถึง PHP7.
ฟังก์ชั่น preg_replace รองรับถึง PHP7.
Parameters
- $patt
- คีย์ใน template
- $replace
- ข้อความที่จะถูกแทนที่ลงในคีย์
- $skin
- template
Returns
string
Assert
('/{TITLE}/', 'Title', '{TITLE}') [==] 'Title'
('/{LNG_([\w\s.-\'(),%\/:&#;]+)}/e', '\Kotchasan\Language::parse(array(1=>"$1"))', '{LNG_Language test}') [==] 'Language test'
|
public
string
|
#
render( )
คืนค่า HTML ถ้าไม่พบ template คืนค่าว่าง.
คืนค่า HTML ถ้าไม่พบ template คืนค่าว่าง.
Returns
string
|