Templates - URW-CE-IT/veloframe GitHub Wiki
VeloFrame’s templating engine lets you build dynamic, reusable UIs with ease. It supports both templates and components.
Templates are HTML files (in templates/
) that can include variables and sub-templates.
Use {![subtemplate_name]}
in your HTML:
{![head]}
In PHP:
$template->includeTemplate("head", new VeloFrame\Template("head"));
Tip: Include all sub-templates first, then set variables in your main template.
Insert variables in your template using {[varname]}
:
<h1>{[title]}</h1>
In PHP:
$template->setVariable("title", "Welcome!");
Components are reusable HTML blocks (in templates/components/
).
In your template:
{[container]}
In PHP:
$container = new VeloFrame\TemplateComponent("container", ["content" => "Hello!"]);
$template->setComponent("container", $container);
If enabled, you can use inline component tags in your HTML:
<_three_card_row title="My Cards"> ... </_three_card_row>
- Keep templates simple and focused.
- Use components for repeated UI blocks.
- Set all variables before rendering.
See API Reference for more details.