Kotchasan Framework Documentation

Kotchasan Framework Documentation

UI Components

TH 05 Feb 2026 07:54

UI Components

เอกสารสำหรับ UI components อื่นๆ ใน Kotchasan

Accordion

\Kotchasan\Accordion สร้าง collapsible sections

use Kotchasan\Accordion;

$accordion = new Accordion();
$accordion->add('Section 1', 'Content for section 1');
$accordion->add('Section 2', 'Content for section 2');

echo $accordion->render();

Grid

\Kotchasan\Grid สำหรับ grid layout

use Kotchasan\Grid;

$grid = new Grid(['cols' => 3]);
$grid->add('<div>Item 1</div>');
$grid->add('<div>Item 2</div>');
$grid->add('<div>Item 3</div>');

echo $grid->render();

HtmlTable

\Kotchasan\HtmlTable สร้างตาราง HTML

use Kotchasan\HtmlTable;

$table = new HtmlTable();
$table->setHeaders(['ID', 'Name', 'Email']);
$table->addRow([1, 'John', 'john@example.com']);
$table->addRow([2, 'Jane', 'jane@example.com']);

echo $table->render();

Methods

Method Description
setHeaders($headers) กำหนด header row
addRow($row) เพิ่มแถวข้อมูล
setClass($class) กำหนด CSS class
render() Render เป็น HTML

CKEditor

\Kotchasan\CKEditor สำหรับ WYSIWYG editor

use Kotchasan\CKEditor;

$editor = new CKEditor([
    'id' => 'content',
    'name' => 'content',
    'value' => $existingContent
]);

echo $editor->render();

DOMParser

\Kotchasan\DOMParser สำหรับ parse HTML

use Kotchasan\DOMParser;

$html = '<div class="content"><p>Hello</p></div>';
$parser = new DOMParser($html);

$content = $parser->querySelector('.content');
$text = $parser->getText();

DOMNode

\Kotchasan\DOMNode สำหรับจัดการ DOM nodes

use Kotchasan\DOMNode;

$node = new DOMNode('div');
$node->setAttribute('class', 'container');
$node->appendChild($child);

echo $node->outerHTML();

Htmldoc

\Kotchasan\Htmldoc สำหรับ HTML document generation

use Kotchasan\Htmldoc;

$doc = new Htmldoc();
$doc->title = 'My Page';
$doc->addMeta('description', 'Page description');
$doc->addScript('app.js');
$doc->addStyle('style.css');

echo $doc->render();

คลาสที่เกี่ยวข้อง