author | Dan |
Tue, 23 Sep 2008 23:24:13 -0400 | |
changeset 48 | d643bfb862d8 |
parent 0 | c63de9eb7045 |
permissions | -rw-r--r-- |
0
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
1 |
<?php |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
2 |
/** |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
3 |
* Smarty plugin |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
4 |
* @package Smarty |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
5 |
* @subpackage plugins |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
6 |
*/ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
7 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
8 |
/** |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
9 |
* Smarty {assign} compiler function plugin |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
10 |
* |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
11 |
* Type: compiler function<br> |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
12 |
* Name: assign<br> |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
13 |
* Purpose: assign a value to a template variable |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
14 |
* @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
15 |
* (Smarty online manual) |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
16 |
* @author Monte Ohrt <monte at ohrt dot com> (initial author) |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
17 |
* @author messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function) |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
18 |
* @param string containing var-attribute and value-attribute |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
19 |
* @param Smarty_Compiler |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
20 |
*/ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
21 |
function smarty_compiler_assign($tag_attrs, &$compiler) |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
22 |
{ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
23 |
$_params = $compiler->_parse_attrs($tag_attrs); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
24 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
25 |
if (!isset($_params['var'])) { |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
26 |
$compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
27 |
return; |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
28 |
} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
29 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
30 |
if (!isset($_params['value'])) { |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
31 |
$compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
32 |
return; |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
33 |
} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
34 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
35 |
return "\$this->assign({$_params['var']}, {$_params['value']});"; |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
36 |
} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
37 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
38 |
/* vim: set expandtab: */ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
39 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
40 |
?> |