~ubuntu-branches/ubuntu/dapper/smarty/dapper-updates

« back to all changes in this revision

Viewing changes to libs/plugins/compiler.assign.php

  • Committer: Bazaar Package Importer
  • Author(s): Dimitri Fontaine
  • Date: 2004-04-16 17:41:20 UTC
  • Revision ID: james.westby@ubuntu.com-20040416174120-qb9ma0g419hkd25g
Tags: 2.6.2-2
* Adapted dependencies to allow running smarty with apache 2 (Closes: #241147)
* Prepared the template for i18n (Closes: #233098)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Smarty {assign} compiler function plugin
 
5
 *
 
6
 * Type:     compiler function<br>
 
7
 * Name:     assign<br>
 
8
 * Purpose:  assign a value to a template variable
 
9
 * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
 
10
 *       (Smarty online manual)
 
11
 * @param string containing var-attribute and value-attribute
 
12
 * @param Smarty_Compiler
 
13
 */
 
14
function smarty_compiler_assign($tag_attrs, &$compiler)
 
15
{
 
16
    $_params = $compiler->_parse_attrs($tag_attrs);
 
17
 
 
18
    if (!isset($_params['var'])) {
 
19
        $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
 
20
        return;
 
21
    }
 
22
 
 
23
    if (!isset($_params['value'])) {
 
24
        $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
 
25
        return;
 
26
    }
 
27
 
 
28
    return "\$this->assign({$_params['var']}, {$_params['value']});";
 
29
}
 
30
 
 
31
/* vim: set expandtab: */
 
32
 
 
33
?>