artiframe make:view
artiframe make:view komutu, projenize yeni bir HTML sayfası (View) ekler.
Yalnızca bir .php dosyası değil; ona ait özel CSS ve JS dosyalarını da birlikte ve doğru dizinlere otomatik olarak oluşturur.
Kullanım
$ artiframe make:view [yol/dosya-adi]
Örnekler
# public/ altında kök seviye bir sayfa
$ artiframe make:view dashboard
# Alt dizinli sayfa
$ artiframe make:view panel/reports
# .php uzantısı opsiyonel — zaten ekler
$ artiframe make:view panel/reports.php
Oluşturulan Dosyalar
Örnek olarak artiframe make:view panel/reports çalıştırıldığında aşağıdaki 3 dosya oluşturulur:
| Dosya | Yol |
|---|---|
| View (PHP) | public/panel/reports.php |
| CSS | public/assets/css/panel/reports.css |
| JS | public/assets/js/panel/reports.js |
View Stub İçeriği
Oluşturulan .php dosyası ArtiFrame mimarisine uygun olarak şu yapıyla gelir:
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/../app/ViewControl.php';
use Bin\ViewMethod;
?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'; ?>
Reports
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/mobilenav.php'; ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
Dikkat edilmesi gerekenler:
data-themevedata-modenitelikleri ArtiFrame'in tema sistemiyle (CSS Variables) çalışır.- CSS ve JS dosyaları
?v=APP_VERSIONönbellek kırma (cache-busting) parametresiyle yüklenir. head.php,header.php,mobilenav.php,footer.phpshared layout bileşenleridir.
JS Stub İçeriği
Otomatik oluşturulan .js dosyası, CSRF token ve Fetch API kullanımına dair hazır bir şablon içerir:
/* JS for Reports */
// CSRF Token (API istekleri için zorunludur)
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
/*
* Fetch API Örnek Kullanımı:
*
* fetch('/api/standart/endpoint', {
* method: 'POST',
* headers: {
* 'Content-Type': 'application/json',
* 'X-CSRF-TOKEN': csrfToken
* },
* body: JSON.stringify({ key: 'value' })
* });
*/
auth/ Özel Davranışı
Eğer hedef yol auth/ ile başlıyorsa (örn: artiframe make:view auth/login), sistem standart view.stub yerine özelleştirilmiş auth-view.stub şablonunu kullanır.
Bu stub, kimlik doğrulama sayfalarına özel minimal bir layout (ortalanmış kart formu, session kontrolü vb.) içerir.