summaryrefslogtreecommitdiff
path: root/smartyplugins/function.form_id.php
blob: 1b8a305660b55524d649387b3599cbcea835c439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Bitweaver\Plugins;

/**
 * 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;
}