Smutty
MVC Framework
View Code: function.form
Browse: All · Classes · Plugins
1
<?php
2
3
/**
4
* returns the html for a form
5
*
6
* @param array $params assoc array of params
7
* @param Smarty $smarty smarty object
8
* @return html
9
*
10
*/
11
13
14
// fetch the url for the request
15
$url = Smutty_Utils::getUrl(
16
Smutty_Utils::strToHash($params['url'])
17
);
18
19
// work out the handler
20
$update = v($params,'update');
21
$handler = v($params,'handler');
22
$feedback = v($params,'feedback');
23
$method = w($params,'method','post');
24
$id = v($params,'id');
25
$form = '';
26
27
// if the form is to be GPG signed then we need
28
// to include a special hidden field
29
if ( v($params,'gpgSigned') )
30
$url .= ENIGFORM_SIG;
31
32
// normal form or ajax form?
33
if ( $update )
34
$form = '<form onsubmit="smutty_ajaxForm(this,' .
35
'\'' . $url . '\',' .
36
'\'' . $update . '\',' .
37
'\'' . $handler . '\',' .
38
'null,' .
39
'\'' . $feedback . '\'' .
40
');return false;" ' .
41
Smutty_Smarty::buildAttrString(array(
42
'id' => v($params,'id'),
43
'class' => v($params,'class')
44
), $smarty ) . '>';
45
else
46
$form = Smutty_Smarty::htmlElement( 'form', array(
47
'method' => $method,
48
'action' => $url,
49
'id' => v($params,'id'),
50
'class' => v($params,'class')
51
), $smarty );
52
53
return $form;
54
55
}
56
58
echo smutty_function_form( $params, $smarty );
59
}
60
61
?>
The code shown here is the code that is currently running this site. If you want to view the latest SVN version of the code then go to the Subversion repository.