summaryrefslogtreecommitdiff
path: root/smartyplugins/function.form_id.php
diff options
context:
space:
mode:
Diffstat (limited to 'smartyplugins/function.form_id.php')
-rw-r--r--smartyplugins/function.form_id.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/smartyplugins/function.form_id.php b/smartyplugins/function.form_id.php
new file mode 100644
index 0000000..486a5a8
--- /dev/null
+++ b/smartyplugins/function.form_id.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * this generates a relatively unique ids for the
+ * ajax attachment portions of a form, which must be uniquely identified
+ * when there are multiple forms enabling attachment uploads on one page.
+ */
+function smarty_function_form_id(){
+ if( !isset( $_SESSION['form_id_index'] ) ){
+ $ret = $_SESSION['form_id_index'] = 1;
+ }else{
+ $ret = ( $_SESSION['form_id_index']++ );
+ }
+ return $ret;
+}
+?>