Последнии сообщения форума
Revise the template admin guide to reflect the current architecture: component/slot syntax, corrected cache path, removal of legacy layout tags, and clarified fragment/partials directory roles.
Core changes:
- Architecture section (admin/info/template/ru.md):
- Rename title to "Phoenix Template Engine" to match class identity
- Clarify layouts/partials/fragments roles with updated descriptions
- Note cache dir: storage/cache/templates/<theme>/
- State that legacy layouts and {%MODULE%}-style tags are removed
Benefits: - Documentation matches the implemented template system - Developers get accurate directory and directive references
Technical notes: - Russian-language documentation file, no code changes
Update tests to reflect renamed template variables in partials/preview.html and the new required fragment path convention for frontend themes.
Core changes:
- Variable name update (tests/Unit/AdminPreviewBridgeFlowTest.php):
Replace fields/fields1/fields2/fields3 with title_html/body_a/body_b/body_c in all three test scenarios (direct render, missing theme, bridge flow)
- Required fragment path update (tests/TemplateValidationTest.php):
Change required template check from basic.html/title.html to fragments/basic.html/fragments/title.html for frontend themes
Benefits: - Tests reflect the actual template variable contract - Fragment path validation aligned with new theme structure
Technical notes: - No test logic changed, only variable names and path strings updated - All three AdminPreviewBridgeFlow scenarios updated consistently
Extract all inline HTML string construction from system.php and admin.php into dedicated template fragment helper functions, backed by per-theme atomic fragment HTML files. Legacy standalone templates deleted; new fragment files added for all four themes (admin, default, lite, simple).
Core changes:
- Fragment rendering functions (core/system.php):
Replace inline foot/category/pager HTML with renderFootControls(), categoryIconLink(), categoryTitleLink(), categoryIconText(), categoryTitleText(), categoryTextLink(), categorySubItem(), categoryRow(), pagerLink(), pagerCurrent()
- Add head_html, blocks_left, blocks_right, blocks_down to adminvars
- Admin UI fragment functions (core/admin.php):
Replace inline tab list/link HTML with adminTabListOpen(), adminTabListClose(), adminTabLink()
- Add adminInfoCountValue() helper using admin-info-count fragment
- Legacy core removed (core/template.php):
- File deleted; functionality fully absorbed by Template class
- New fragment HTML files (templates/*/fragments/):
Add ~50 atomic fragment files per theme: comment, editor, admin-block, session, preview-title, foot-controls, navi-lower, etc.
Update partials/preview.html variable API: fields → title_html, fields1 → body_a, fields2 → body_b, fields3 → body_c
- Update fragments/comment.html for all themes
- Legacy templates removed:
Delete basic.html, title.html, preview.html, spoiler.html, warn.html, basic-changelog*.html, layouts/main.html and similar per-theme files
Benefits: - Inline HTML fully removed from PHP business logic - Theme authors can override any UI fragment without touching PHP - Consistent, semantic variable names across all fragment templates
Technical notes: - partials/preview.html variables renamed: fields/fields1/fields2/fields3 → title_html/body_a/body_b/body_c (breaking for custom themes) - renderFootControls() replaces hardcoded foot_html string - All themes must provide required fragment files
Introduce {% component %}/{% endcomponent %} and {% slot %}/{% endslot %} directives into the template compiler, enabling partials to receive isolated props and inlined slot payloads. Correct the view cache directory path from cache/view/ to cache/templates/ for consistency with storage layout.
Core changes:
- Component/slot filters (core/classes/template.php):
Add filterComp() for {% component 'partials/foo.html' with vars %}...{% endcomponent %} * Path restricted to partials/ subdirectory * Prevents nested component blocks * Passes isolated props array and slot body to getComp()
- Add filterSlot() for {% slot name %}...{% endslot %} placeholders
- Compilation pipeline (core/classes/template.php):
- Register filterComp() and filterSlot() in compileCode()
- Add $slots property for slot state tracking
- Cache path correction (core/classes/template.php):
- Change cache dir: storage/cache/view/{theme} → storage/cache/templates/{theme}
Benefits: - Reusable partials with dynamic slot content - Template logic stays declarative and HTML-author-friendly - Cache path aligned with storage layout convention
Technical notes: - Component nesting is explicitly blocked at compile time - Slot body is passed as raw string evaluated in partial scope - No existing templates used {% component %}, no migration needed
Finalize Phase 6–9 changes for the lite theme and clean up test support files after Phase 12 legacy removal.
Core changes:
- Lite theme layout migration (templates/lite/):
- Delete index.html and index-main.html (legacy shell files)
- Refactor index.php to data-only provider
- Update layouts/app.html and layouts/home.html to new engine contract
- Add partials: menu.html, forum-teaser.html, contact-block.html
- Add fragments: forum-pagenum.html, forum-teaser-item.html
- Admin theme fragments (templates/admin/fragments/):
- Add admin-lang-item.html and admin-menu-item.html
- Test suite (tests/):
- Remove getThemeLoad/getThemeFile stubs from ViewTestBootstrap.php
- Fix if/endif balance regex in TemplateValidationTest.php
- Remove stale lite-menu assertion in ViewBridgeSmokeTest.php
Benefits: - Lite theme fully decoupled from legacy shell rendering - All themes consistent with new Template engine contract - Test suite passes cleanly after legacy stub removal
Add automatic CSS/JS loading from theme directories, removing the need to manually list theme files in config. Remove legacy admin shell files and the archived default_old theme directory as part of Phase 12 cleanup.
Core changes:
- Universal theme asset loader (core/system.php):
Add getThemeAssets(theme, ext) — scans theme root, assets/vendor/*/, assets/{ext}/, and legacy js/ subdir in the correct load order
- Modify doCss() to auto-append theme CSS dirs (root, vendor, assets/css)
- Modify doScript() to auto-append theme JS files via getThemeAssets()
- Config decoupling (config/global.php):
Remove templates/[theme]/ and plugins/bootstrap/ from css_f (bootstrap now loaded from theme vendor dir automatically)
- Theme assets are fully discovered at runtime, not config-driven
- Legacy removal (templates/admin/, templates/default_old/):
- Delete templates/admin/index.html and index-home.html (Phase 12)
- Delete templates/default_old/ directory (archived legacy theme)
- Clean up templates/admin/index.php (data-only provider)
- Fix statistic path (core/user.php):
- Replace CONFIG_DIR with COUNTER_DIR for statistic.log read
Benefits: - Adding a new theme requires zero config changes for CSS/JS loading - Vendor libs bundled with a theme are picked up automatically - Load order guaranteed: root → vendor → assets/css|js
Technical notes: - getThemeAssets() uses glob() with GLOB_ONLYDIR for vendor subdirs - Applies to both frontend and admin rendering paths - Cache invalidation: existing CSS/JS caches are bypassed on next request
Replace the string-replace index.php pipeline in setHead()/setFoot() with $tpl->getHtmlPage(); introduce pages, layouts, partials and fragments for all themes; migrate setExit() in access.php and security.php to the same engine.
Core changes:
- Render pipeline (core/system.php):
- setHead() buffers output via ob_start() and stores vars in $sitevars / $adminvars
- setFoot() renders the full page via $tpl->getHtmlPage() using those vars
- Unified theme resolution: getTheme() no longer returns 'admin' for ADMIN_FILE
- $tpl always instantiated with resolved theme (no more separate admin branch)
- addblocks() calls for left/right/down/message/center/foot moved into setFoot()
- setExit() migration (core/access.php, core/security.php):
- Both versions replaced inline HTML with $tpl->getHtmlPage('message')
- alert fragment used for the error message body
- Template structure — new files per theme (admin, default, lite, simple):
- layouts: app.html, home.html, admin.html, bare.html
- pages: module.html, home.html, admin.html, login.html, message.html, preview.html
- partials: login.html, registration.html, searchbox.html, preview.html
fragments: block-left, code, comment, form-conf, hide, list-bottom, open, close, pagenum, panel-admin, panel-modul, quote, spoiler, voting-*, basic-monitor, basic
- Fragment updates:
- title.html extended in all themes with icon/subtitle/content layout block
- Theme head/foot vars (templates/admin/index.php, templates/lite/index.php):
getAdminHeadVars() / getThemeHeadVars() / getThemeFootVars() return plain array keys (no {%key%} format) to match the new Template data contract
- Fixes and tests:
- modules/news/index.php: guard is_user() before $user[1] access
tests: updated AdminLoginBridgeFlowTest, AdminPreviewBridgeFlowTest, AdminSearchboxBridgeFlowTest for unified theme; added ViewBridgeSmokeTest cases for module/home page render; added AdminPageRenderFlowTest
- Config:
- config/global.php: sitekey rotated, active theme set to 'simple'
Benefits: - Page rendering fully managed by the Template class for all themes and contexts - setHead/setFoot no longer depend on index.php file or string-replace placeholders - All three render contexts (frontend, admin, exit) use the same engine
Technical notes: - index.php file is no longer read or parsed by setHead/setFoot - {%placeholder%} vars in theme index.php files are no longer used for page assembly
Drop core/template.php content and all setTemplate* functions; wire all remaining call sites to $tpl->getHtmlFrag(); extract visitor tracking from setHead() into three dedicated functions.
Core changes:
- Legacy template system (core/template.php, core/system.php):
- Emptied core/template.php — all setTemplate* functions removed
- Switched require from core/template.php to core/classes/template.php
- Replaced $GLOBALS['tpl'] with direct global $tpl in closures
- Renamed param $tpl to $frag in setPageNumbers() and num_ajax()
- Fixed uninitialized $barr in getBlocks()
- Visitor tracking extraction (core/system.php):
- Extracted session tracking into updateSessionTrack()
- Extracted referer tracking into updateRefererTrack()
- Extracted statistics tracking into updateStatsTrack()
- Theme template function refactor (templates/admin/index.php, templates/lite/index.php):
- setTemplateHead() replaced by getAdminHeadVars() / getThemeHeadVars() — returns array
- setTemplateFoot() replaced by getThemeFootVars() — returns array
- setTemplateBlock() removed from both template files
- Call site migration (core/admin.php, core/user.php, admin/index.php, index.php):
- All remaining setTemplateBlock() and setTemplateWarning() calls replaced with $tpl->getHtmlFrag()
- Tests cleanup (tests/):
- Removed TemplateBridgeFallbackTest, TemplateBridgeFlowTest, TemplateIfTest, TemplateTest
- Updated ViewTestBootstrap and TemplateValidationTest for new class path
- Misc (modules/main/index.php, templates/default/layouts/main.html):
- Fixed mojibake in Russian content strings to proper UTF-8
- Added templates/default/layouts/main.html as new default layout file
Benefits: - Single Template class is now the only rendering engine; old string-replace system removed - Visitor tracking isolated in named functions; setHead() reduced in scope - Theme functions return data arrays instead of rendered strings
Technical notes: - setTemplateBlock(), setTemplateWarning(), setTemplateBasic() no longer exist - storage/counter/ips.log removed from version control
Core changes: - modules/order/admin/info/russian.html: removed (replaced by Markdown) - modules/order/admin/info/ru.md: new Markdown version of order admin docs - admin/info/database/ru.md: updated database admin documentation





