|
dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
|
Public Member Functions | |
| replaces (string $tpl, $replaces) | |
| Ersetzt {var} durch Werte aus $data. | |
| replaces_dbx (string $tpl) | |
| Ersetzt DBX-Systemvariablen (CACHEBAR!). | |
| cleanup_optional_placeholders (string $content) | |
| Entfernt optionale Template-Slots, die bis zur finalen Ausgabe absichtlich unverarbeitet bleiben duerfen. | |
| read_tpl ($modul, $file, $type='htm') | |
| Lädt Template + cached es (inkl. | |
| get_tpl ($file, $data='', $type='htm', $i=0, $depth=0) | |
| Zentrale Template-Funktion. | |
| get_design_tpl ($design, $page, $language='de', $type='htm', $repurl=1) | |
| Lädt das Design-Template für eine bestimmte Seite und Sprache. | |
| get_design_tpl_dir_file ($type, $design, $file, $fallback=true) | |
| Public Member Functions inherited from dbxObj | |
| set_callback_owner ($owner) | |
| Setzt ein explizites Owner-Objekt fuer Callback-Aufrufe. | |
| set_callback_id (string $id) | |
| Setzt den Namenspraefix fuer konventionelle Callback-Methoden. | |
| set_callback (string $event, string $callback) | |
| Ordnet einem Event einen konkreten Methodennamen zu. | |
| set_property ($name, $value, $section='', $modul='modul') | |
| Speichert eine Objekt- oder Session-Property. | |
| get_property ($name, $default='', $section='', $modul='modul') | |
| Liest eine Objekt- oder Session-Property. | |
| del_property ($name, $section='', $modul='modul') | |
| Loescht eine Objekt- oder Session-Property. | |
| dbx_next_process ($content, $process='', $mode='append') | |
| Fuegt den naechsten dbxProcess-Schritt in eine Ausgabe ein. | |
Public Attributes | |
| $_modul = 'dbx' | |
| Public Attributes inherited from dbxObj | |
| Public | $_properties =array() |
| Public | $_section ='' |
| Public | $_process ='' |
Additional Inherited Members | |
| Protected Member Functions inherited from dbxObj | |
| normalize_callback_id (string $id) | |
| Normalisiert Callback-IDs auf gueltige PHP-Methodenbestandteile. | |
| get_callback_name (string $event) | |
| Liefert den Methodennamen fuer ein Event. | |
| get_callback_owner () | |
| Liefert das aktuelle Owner-Objekt fuer Callback-Aufrufe. | |
| callback (string $event, mixed $value) | |
| Fuehrt einen Callback aus und gibt dessen Rueckgabewert zurueck. | |
| Protected Attributes inherited from dbxObj | |
| $_callback_owner = null | |
| $_callback_id = '' | |
| $_callbacks = array() | |
Die Klasse dbxTPL ist die zentrale Rendering-Engine des DBX-Systems. Sie ist bewusst einfach, deterministisch und performance-optimiert.
Templates sind reine Textdateien ohne Template-Sprache. Unterstützt werden nur:
{var} → Variablenersetzung [inc=...]...[/inc] → bedingte Inhalte [tpl=modul|file] → Template-Include (rekursiv)
get_tpl($file, $data = '', $type = 'htm', $i = 0, $depth = 0)
Zentrale Rendering-Funktion für Modul-Templates.
Modul Templates:
/dbx/modules/{modul}/tpl/{type}/{file}.htm /dbx/modules/{modul}/tpl/{type}/{file}_{lng}.htm
Sprach-Fallback:
file_de.htm → bevorzugt file.htm → fallback
Speicherort:
$_SESSION['dbx']['cache']['tpl']
Struktur:
[modul][file][type][lng] = [ 'tpl' => 'Template-Inhalt (nach replaces_dbx)', 'path' => 'Dateipfad' ]
Cache enthält: ✔ Template-Inhalt ✔ replaces_dbx() Ergebnis ✔ Dateipfad
Cache enthält NICHT: ✘ $data replaces ✘ [inc] ✘ [tpl] ✘ Editor-Marker
Ziel: Maximale Performance bei vielen Template-Aufrufen (z.B. Tabellen)
Data Replace (replaces)
{name} → $data['name']
DBX Replace (replaces_dbx) – wird gecached
{dbx:lng} {dbx:design} {dbx:page} {dbx:title} {dbx:perma} {dbx:meta_description} {dbx:meta_keywords} {dbx:canonical} {dbx:robots} {dbx:og_title} {dbx:og_description} {dbx:og_image} {dbx:og_url} {dbx:head_meta}
Syntax:
[inc=1]Text[/inc] [inc=0]Text[/inc]
Verhalten:
1 → Inhalt bleibt 0 → Inhalt wird entfernt
Funktionen (Whitelist):
[inc=has_group('admin')]
Wichtig:
Syntax:
[tpl=modul|file] [tpl=modul|file|type]
Default:
type = 'htm'
Verhalten:
→ ruft intern get_tpl() auf → Ergebnis ersetzt den Tag
Eigenschaften:
✔ rekursiv ✔ $data wird weitergereicht ✔ verschachtelbar
Loop-Schutz:
maxDepth = 10
Marker werden in Templates eingefügt:
... content ...
Zweck:
Eigenschaften:
✔ zerstört kein HTML ✔ funktioniert mit
etc. ✔ unterstützt verschachtelte Templates
Steuerung über dbx_edit:
1 → nur Module ≠ dbx 2 → nur Modul dbx 3 → Level 1 + Level 2 4 → FD Definitionen 5 → DD Definitionen 6 → Modul-/Include-Class 7 → myX System-Class 8 → config.php 9 → alles
Funktion:
get_design_tpl($design, $page, $language, $type)
Eigenschaften:
✘ kein Cache (nur einmal geladen) ✔ nutzt replaces_dbx() ✔ unterstützt Editor-Marker ✔ setzt Systemzustand (SysVar)
Pfad:
/dbx/design/{design}/{type}/{file}.htm
Fallback:
default.htm
Optimiert für:
Strategie:
Bewusst NICHT enthalten:
✘ keine Loops ✘ keine komplexe Logik ✘ keine Template-Sprache
Stattdessen:
✔ einfache, kontrollierte Bausteine ✔ volle Kontrolle im PHP-Code
✔ schnell ✔ stabil ✔ deterministisch ✔ erweiterbar
Definition at line 278 of file dbxTPL.class.php.
| dbxTPL::cleanup_optional_placeholders | ( | string | $content | ) |
Entfernt optionale Template-Slots, die bis zur finalen Ausgabe absichtlich unverarbeitet bleiben duerfen.
[dbx:js] wird von Form/Report zuerst mit geschuetztem JavaScript belegt. Bleibt der Marker danach noch stehen, existiert fuer diese Ausgabe kein JavaScript. {bar_middle} ist ein optionaler Bar-Slot.
Definition at line 448 of file dbxTPL.class.php.
| dbxTPL::get_design_tpl | ( | $design, | |
| $page, | |||
| $language = 'de', | |||
| $type = 'htm', | |||
| $repurl = 1 ) |
Lädt das Design-Template für eine bestimmte Seite und Sprache.
| string | $design | Das Design, das geladen werden soll. |
| string | $page | Die Seite, die geladen werden soll. |
| string | $language | Die Sprache, die verwendet werden soll. |
| string | $type | Der Typ des Templates, z. B. 'htm' oder 'php'. Standard ist 'htm'. |
| int | $repurl | Bestimmt, ob URLs ersetzt werden sollen (1 = Ja, 0 = Nein). Standard ist 1. |
Definition at line 767 of file dbxTPL.class.php.
References $config, dbx_os_path_file(), get_design_tpl_dir_file(), and replaces_dbx().
| dbxTPL::get_design_tpl_dir_file | ( | $type, | |
| $design, | |||
| $file, | |||
| $fallback = true ) |
Definition at line 878 of file dbxTPL.class.php.
References $base, and dbx_get_base_dir().
Referenced by get_design_tpl().
| dbxTPL::get_tpl | ( | $file, | |
| $data = '', | |||
| $type = 'htm', | |||
| $i = 0, | |||
| $depth = 0 ) |
Zentrale Template-Funktion.
Pipeline:
Definition at line 697 of file dbxTPL.class.php.
References read_tpl(), and replaces().
| dbxTPL::read_tpl | ( | $modul, | |
| $file, | |||
| $type = 'htm' ) |
Lädt Template + cached es (inkl.
replaces_dbx)
Definition at line 464 of file dbxTPL.class.php.
References $base, dbx_get_base_dir(), and replaces_dbx().
Referenced by get_tpl().
| dbxTPL::replaces | ( | string | $tpl, |
| $replaces ) |
Ersetzt {var} durch Werte aus $data.
Definition at line 294 of file dbxTPL.class.php.
References if.
Referenced by get_tpl().
| dbxTPL::replaces_dbx | ( | string | $tpl | ) |
Ersetzt DBX-Systemvariablen (CACHEBAR!).
Definition at line 320 of file dbxTPL.class.php.
Referenced by get_design_tpl(), and read_tpl().
| dbxTPL::$_modul = 'dbx' |
Definition at line 284 of file dbxTPL.class.php.