cvs: smarty /docs programmers.sgml

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1061390767@cvsserver>
messju		Wed Aug 20 10:46:07 2003 EDT

  Modified files:              
    /smarty/docs	programmers.sgml 
  Log:
  fixed examples for register_function() and register_block()
  
  
Index: smarty/docs/programmers.sgml
diff -u smarty/docs/programmers.sgml:1.44 smarty/docs/programmers.sgml:1.45
--- smarty/docs/programmers.sgml:1.44	Thu Aug  7 18:15:12 2003
+++ smarty/docs/programmers.sgml	Wed Aug 20 10:46:07 2003
@@ -1151,10 +1151,10 @@
 $smarty->register_block("translate", "do_translation");
 
 function do_translation ($params, $content, &$smarty, &amp;$repeat) {
-    if ($content) {
+    if (isset($content)) {
         $lang = $params['lang'];
         // do some translation with $content
-        echo $translation;
+        return $translation;
     }
 }
 
@@ -1237,7 +1237,7 @@
     extract($params);
     if(empty($format))
         $format="%b %e, %Y";
-    echo strftime($format,time());
+    return strftime($format,time());
 }
 
 // now you can use this in Smarty to print the current date: {date_now}
@@ -2893,10 +2893,10 @@
  */
 function smarty_block_translate($params, $content, &amp;$smarty)
 {
-    if ($content) {
+    if (isset($content)) {
         $lang = $params['lang'];
         // do some intelligent translation thing here with $content
-        echo $translation;
+        return $translation;
     }
 }</programlisting>
     </example>



-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.