-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
The Smarty template
{system("id")}
works splendidly.
Sometimes, though, you want to use the deprecated php tag (e.g. to model possible very old apps out there in the wild) to do the same thing, e.g.
{php}echo `id`;{/php}
That doesn't work currently, as php tags were desupported by Smarty a very long time ago.
They can still be enabled by using SmartyBC instead of Smarty, see https://www.smarty.net/docs/en/bc.tpl
One might think this change would be easy:
--- a/php/example-app/routes/web.php
+++ b/php/example-app/routes/web.php
@@ -159,7 +159,7 @@ function getParam(Request $request, string $paramName) {
$template = getTemplate($name, "Smarty");
try {
- $smarty = new Smarty();
+ $smarty = new SmartyBC(); // SmartyBC allows php tags; Smarty doesn't
$smarty->enableSecurity();
return $smarty->fetch('eval:'.$template);
} catch (Exception $e) {
however, that alone leads to 500 errors on Smarty fetches.
(I imagine it doesn't know where SmartyBC is, and one needs to update the class autoloader stuff with a command like
$ cd php/example-app
$ composer dump-autoloader
and then adding the updated vendor directory, or something, but I haven't had much luck with that here, possibly because my composer and php are too new.)
Metadata
Metadata
Assignees
Labels
No labels