|
Revision 2605, 0.6 kB
(checked in by auno, 18 months ago)
|
|
Added mteval modifier for dynamic.
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
|---|
| 3 | # This program is distributed under the terms of the |
|---|
| 4 | # GNU General Public License, version 2. |
|---|
| 5 | # |
|---|
| 6 | # $Id$ |
|---|
| 7 | |
|---|
| 8 | function smarty_modifier_mteval($text, $arg) { |
|---|
| 9 | if (!$arg) return $text; |
|---|
| 10 | |
|---|
| 11 | global $mt; |
|---|
| 12 | $ctx =& $mt->context(); |
|---|
| 13 | $_var_compiled = ''; |
|---|
| 14 | if (!$ctx->_compile_source('evaluated template', $text, $_var_compiled)) { |
|---|
| 15 | return $ctx->error("Error compiling text '$text'"); |
|---|
| 16 | } |
|---|
| 17 | ob_start(); |
|---|
| 18 | $ctx->_eval('?>' . $_var_compiled); |
|---|
| 19 | $_contents = ob_get_contents(); |
|---|
| 20 | ob_end_clean(); |
|---|
| 21 | return $_contents; |
|---|
| 22 | } |
|---|
| 23 | ?> |
|---|