You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$s = new \Smarty();
$s->assign("settings", $settings);
return$s->fetch('string:' . $template);
То есть нужна функция, аналогичная setTemplate(), только
setTemplateFile() - файл шаблона
setTemplate() - шаблон из строки или setTemplateContent()
Это обратно-несовместие изменение.
Smarty can render templates from a string by using the string: or eval: resource.
The string: resource behaves much the same as a template file. The template source is compiled from a string and stores the compiled template code for later reuse. Each unique template string will create a new compiled template file. If your template strings are accessed frequently, this is a good choice. If you have frequently changing template strings (or strings with low reuse value), the eval: resource may be a better choice, as it doesn\'t save compiled templates to disk.
The eval: resource evaluates the template source every time a page is rendered. This is a good choice for strings with low reuse value. If the same string is accessed frequently, the string: resource may be a better choice.
Adding your own resource type
<?phpclass HelloWorldResource extendsSmarty\Resource\CustomPlugin {
protectedfunctionfetch($name, &$source, &$mtime) {
$source = '{$x="hello world"}{$x}'; // load your template here based on $name$mtime = time();
}
}
// ..$smarty->registerResource('helloworld', newHelloWorldResource());
The text was updated successfully, but these errors were encountered:
https://smarty-php.github.io/smarty/stable/api/resources/
То есть нужна функция, аналогичная
setTemplate()
, толькоsetTemplateFile()
- файл шаблонаsetTemplate()
- шаблон из строки илиsetTemplateContent()
Это обратно-несовместие изменение.
Smarty can render templates from a string by using the string: or eval: resource.
Adding your own resource type
The text was updated successfully, but these errors were encountered: