cvs: smarty /docs/en/designers/language-custom-functions language-function-eval.xml

[email protected] ("Peter 'Mash' Morgan") Sun, 26 Mar 2006 14:59:10 -0000
Newsgroups php.smarty.cvs
Message-ID <cvspete_morgan1143385150@cvsserver>
pete_morgan		Sun Mar 26 14:59:10 2006 UTC

  Modified files:              
    /smarty/docs/en/designers/language-custom-functions	
                                                       	language-function-eval.xml 
  Log:
  Cleaned up some ws and another example
  
http://cvs.php.net/viewcvs.cgi/smarty/docs/en/designers/language-custom-functions/language-function-eval.xml?r1=1.4&r2=1.5&diff_format=u
Index: smarty/docs/en/designers/language-custom-functions/language-function-eval.xml
diff -u smarty/docs/en/designers/language-custom-functions/language-function-eval.xml:1.4 smarty/docs/en/designers/language-custom-functions/language-function-eval.xml:1.5
--- smarty/docs/en/designers/language-custom-functions/language-function-eval.xml:1.4	Tue Sep 13 19:03:11 2005
+++ smarty/docs/en/designers/language-custom-functions/language-function-eval.xml	Sun Mar 26 14:59:10 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
 <sect1 id="language.function.eval">
  <title>{eval}</title>
   <para>
@@ -69,30 +69,30 @@
  </note>
  <example>
   <title>{eval}</title>
+  
   <programlisting>
 <![CDATA[
-   setup.conf
-   ----------
-
-   emphstart = <strong>
-   emphend = </strong>
-   title = Welcome to {$company}'s home page!
-   ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
-   ErrorState = You must supply a {#emphstart#}state{#emphend#}.
+#setup.conf
+#----------
+emphstart = <strong>
+emphend = </strong>
+title = Welcome to {$company}'s home page!
+ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
+ErrorState = You must supply a {#emphstart#}state{#emphend#}.
 ]]>
   </programlisting>
   <para>
-   Where index.tpl is:
+   Where the template is:
   </para>
   <programlisting>
 <![CDATA[
-   {config_load file="setup.conf"}
+{config_load file='setup.conf'}
 
-   {eval var=$foo}
-   {eval var=#title#}
-   {eval var=#ErrorCity#}
-   {eval var=#ErrorState# assign="state_error"}
-   {$state_error}
+{eval var=$foo}
+{eval var=#title#}
+{eval var=#ErrorCity#}
+{eval var=#ErrorState# assign='state_error'}
+{$state_error}
 ]]>
   </programlisting>
   <para>
@@ -100,14 +100,37 @@
   </para>
   <screen>
 <![CDATA[
-   This is the contents of foo.
-   Welcome to Foobar Pub & Grill's home page!
-   You must supply a <strong>city</strong>.
-   You must supply a <strong>state</strong>.
-
+This is the contents of foo.
+Welcome to Foobar Pub & Grill's home page!
+You must supply a <strong>city</strong>.
+You must supply a <strong>state</strong>.
 ]]>
   </screen>
  </example>
+ 
+  <example>
+   <title>another {eval} example</title>
+   <para>This example outputs the server name and IP. 
+   The variable $str could be from a database for example.</para>
+   <programlisting role="php">
+ <![CDATA[
+// php script
+$str = 'The server name is {$smarty.server.SERVER_NAME|upper} '
+       'at {$smarty.server.SERVER_ADDR}';
+$smarty->assign('foo',$str);
+ ]]>
+   </programlisting>
+   <para>
+    Where the template is:
+   </para>
+   <programlisting>
+ <![CDATA[
+    {eval var=$foo}
+ ]]>
+   </programlisting>
+ </example>
+ 
+ 
 </sect1>
 <!-- Keep this comment at the end of the file
 Local variables: