Component Library
Below is the documentation for the built-in reusable components, helpers, and utilities available in the system.
1. Upload System
1.1 Upload Helper
Located in: app/Helpers/upload_helper.php
Comprehensive file upload with validation, compression, and preview generation.
| Function | Description |
|---|---|
upload_file($file, $options) | Generic upload with type/size validation |
upload_image($file, $options) | Image upload with compression/resize |
generate_thumbnail($path, $w, $h) | Generate thumbnails for images/PDFs |
helper('upload');
$result = upload_image($file, [
'directory' => 'uploads/images',
'maxWidth' => 1920,
'quality' => 85
]);2. FilePond Component
Modern drag-drop file upload with preview support. Supports images and documents.
<?= component('filepond', [
'name' => 'attachment',
'accept' => ['image/jpeg', 'application/pdf'],
'maxSize' => '5MB'
]) ?>3. AJAX Component Rendering
Wrap any component to enable partial page updates without reload.
<!-- Auto-refresh every 30 seconds -->
<?= ajax_component('notification_bell', [], true, 'bell-id', 30000) ?>4. Trumbowyg Editor
Lightweight rich text editor.
<?= component('trumbowyg', [
'name' => 'content',
'height' => 300,
'required' => true
]) ?>5. GLightbox
Image lightbox with zoom functionality. Auto-initialized on elements with data-glightbox.
<a href="/image.jpg" data-glightbox>
<img src="/thumb.jpg">
</a>6. Breadcrumb
Auto-generate breadcrumbs from URI or manual items.
<?= component('breadcrumb') ?>7. Form Errors
Display server-side validation errors with auto-styling.
<?= component('form_errors', ['errors' => validation_errors()]) ?>