cvs: smarty /docs appendixes.sgml programmers.sgml
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1074096984@cvsserver> |
messju Wed Jan 14 11:16:24 2004 EDT
Modified files:
/smarty/docs appendixes.sgml programmers.sgml
Log:
removed suggestions to use extract() from the manual
Index: smarty/docs/appendixes.sgml
diff -u smarty/docs/appendixes.sgml:1.12 smarty/docs/appendixes.sgml:1.13
--- smarty/docs/appendixes.sgml:1.12 Wed Oct 29 17:46:44 2003
+++ smarty/docs/appendixes.sgml Wed Jan 14 11:16:24 2004
@@ -230,12 +230,11 @@
<programlisting>
// be sure apache is configure for the .wml extensions!
// put this function somewhere in your application, or in Smarty.addons.php
-function insert_header() {
+function insert_header($params) {
// this function expects $content argument
- extract(func_get_arg(0));
- if(empty($content))
+ if(empty($params['content']))
return;
- header($content);
+ header($params['content']);
return;
}
Index: smarty/docs/programmers.sgml
diff -u smarty/docs/programmers.sgml:1.49 smarty/docs/programmers.sgml:1.50
--- smarty/docs/programmers.sgml:1.49 Mon Jan 12 14:46:12 2004
+++ smarty/docs/programmers.sgml Wed Jan 14 11:16:24 2004
@@ -1221,9 +1221,10 @@
$smarty->register_function("date_now", "print_current_date");
function print_current_date ($params) {
- extract($params);
- if(empty($format))
- $format="%b %e, %Y";
+ if(empty($params['format']))
+ $format = "%b %e, %Y";
+ else
+ $format = $params['format'];
return strftime($format,time());
}
@@ -2622,10 +2623,7 @@
<para>
All attributes passed to template functions from the template are
contained in the <parameter>$params</parameter> as an associative
- array. Either access those values directly, e.g.
- <varname>$params['start']</varname> or use
- <varname>extract($params)</varname> to import them into the symbol
- table.
+ array.
</para>
<para>
The output (return value) of the function will be substituted in place of the
@@ -2694,9 +2692,7 @@
*/
function smarty_function_assign($params, &$smarty)
{
- extract($params);
-
- if (empty($var)) {
+ if (empty($params['var'])) {
$smarty->trigger_error("assign: missing 'var' parameter");
return;
}
@@ -2706,7 +2702,7 @@
return;
}
- $smarty->assign($var, $value);
+ $smarty->assign($params['var'], $params['value']);
}
?></programlisting>
</example>
@@ -2825,10 +2821,8 @@
Only the opening tag of the block function may have attributes. All
attributes passed to template functions from the template are contained
in the <parameter>$params</parameter> as an associative array. You can
- either access those values directly, e.g.
- <varname>$params['start']</varname> or use
- <varname>extract($params)</varname> to import them into the symbol
- table. The opening tag attributes are also accessible to your function
+ access those values as e.g. <varname>$params['start']</varname>.
+ The opening tag attributes are also accessible to your function
when processing the closing tag.
</para>
<para>
@@ -3221,10 +3215,7 @@
</funcsynopsis>
<para>
The first parameter to the function is an associative array of
- attributes passed to the insert. Either access those values directly,
- e.g. <varname>$params['start']</varname> or use
- <varname>extract($params)</varname> to import them into the symbol
- table.
+ attributes passed to the insert.
</para>
<para>
The insert function is supposed to return the result which will be
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php