tigron/skeleton-template

骨架模板库

v0.1.8 2024-02-29 10:15 UTC

This package is auto-updated.

Last update: 2024-08-29 11:22:54 UTC


README

描述

骨架的通用模板。此库支持多个模板库作为后端。目前仅通过 skeleton-template-twig 支持Twig后端。

安装

通过composer安装

composer require tigron/skeleton-template

如何操作

// Initialize a template object
$template = new \Skeleton\Template\Template();

// Add a template path
$template->add_template_path($my_very_cool_path);

// Set a translation object (optional);
$template->set_translation(\Skeleton\I18n\Translation $translation);

// Assign variables
$template->assign('my_variable_name', 'content1');
$template->assign('my_variable_name2', 'content2');

// return the rendered template
$html = $template->render('test.twig');

// $html contains the rendered template