mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-29 11:21:36 +01:00
- updated for 2.6.3
- updates for new build system - added missing files - corrections from users - revcheck comments for all files - big up to didou and nuno, brilliant work - make test: ok - make: ok
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.2 Maintainer: andreas Status: ready -->
|
||||
<sect1 id="plugins.functions"><title>Template-Funktionen</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
@@ -35,29 +36,32 @@
|
||||
<example>
|
||||
<title>Funktionsplugin mit Ausgabe</title>
|
||||
<programlisting>
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.eightball.php
|
||||
* Type: function
|
||||
* Name: eightball
|
||||
* Purpose: outputs a random magic answer
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_eightball($params, &$smarty)
|
||||
{
|
||||
$answers = array('Yes',
|
||||
'No',
|
||||
'No way',
|
||||
'Outlook not so good',
|
||||
'Ask again soon',
|
||||
'Maybe in your reality');
|
||||
|
||||
$result = array_rand($answers);
|
||||
echo $answers[$result];
|
||||
}
|
||||
?></programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.eightball.php
|
||||
* Type: function
|
||||
* Name: eightball
|
||||
* Purpose: outputs a random magic answer
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_eightball($params, &$smarty)
|
||||
{
|
||||
$answers = array('Yes',
|
||||
'No',
|
||||
'No way',
|
||||
'Outlook not so good',
|
||||
'Ask again soon',
|
||||
'Maybe in your reality');
|
||||
|
||||
$result = array_rand($answers);
|
||||
return $answers[$result];
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
@@ -71,33 +75,34 @@
|
||||
<example>
|
||||
<title>Funktionsplugin ohne Ausgabe</title>
|
||||
<programlisting>
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.assign.php
|
||||
* Type: function
|
||||
* Name: assign
|
||||
* Purpose: assign a value to a template variable
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_assign($params, &$smarty)
|
||||
{
|
||||
extract($params);
|
||||
|
||||
if (empty($var)) {
|
||||
$smarty->trigger_error("assign: missing 'var' parameter");
|
||||
return;
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.assign.php
|
||||
* Type: function
|
||||
* Name: assign
|
||||
* Purpose: assign a value to a template variable
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_assign($params, &$smarty)
|
||||
{
|
||||
if (empty($params['var'])) {
|
||||
$smarty->trigger_error("assign: missing 'var' parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!in_array('value', array_keys($params))) {
|
||||
$smarty->trigger_error("assign: missing 'value' parameter");
|
||||
return;
|
||||
$smarty->trigger_error("assign: missing 'value' parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
$smarty->assign($var, $value);
|
||||
}
|
||||
?></programlisting>
|
||||
|
||||
$smarty->assign($params['var'], $params['value']);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
@@ -120,4 +125,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user