summaryrefslogtreecommitdiff
path: root/lib/smarty-plugins/function.varvar.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-10-11 14:01:29 +0200
committeremkael <emkael@tlen.pl>2016-10-11 14:01:29 +0200
commit51609351f2c4b5082b7e6f0744cd3811c325303f (patch)
tree739015e9ec69bc185ebe30db21369ae0b8b692ce /lib/smarty-plugins/function.varvar.php
parent8d1b0dad63e3906efa9393ef01d08b77d83417b5 (diff)
* initial template
Diffstat (limited to 'lib/smarty-plugins/function.varvar.php')
-rw-r--r--lib/smarty-plugins/function.varvar.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/smarty-plugins/function.varvar.php b/lib/smarty-plugins/function.varvar.php
new file mode 100644
index 0000000..36c9776
--- /dev/null
+++ b/lib/smarty-plugins/function.varvar.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Smarty {varvar} function plugin
+ *
+ * Type: function
+ * Name: varvar
+ * Purpose: Assume the input is a string, and if a smarty variable with that name
+ * is set, return its value. Otherwise, return the original string
+ * @param array
+ * @param Smarty
+ */
+function smarty_function_varvar($params, &$smarty) {
+ $value = $smarty->getTemplateVars();
+ $ret = $value[$params['var']];
+ if ($ret) {
+ return $ret;
+ } else {
+ return $params['var'];
+ }
+}
+?> \ No newline at end of file