cvs: peardoc /en/package/html html-template-flexy.xml /en/package/html/html-template-flexy/attribute tojavascript.xml

From: Date: Sat, 23 Jul 2005 04:10:55 +0000
Subject: cvs: peardoc /en/package/html html-template-flexy.xml /en/package/html/html-template-flexy/attribute tojavascript.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6559@lists.php.net to get a copy of this message
alan_k Sat Jul 23 00:10:55 2005 EDT Added files: /peardoc/en/package/html/html-template-flexy/attribute tojavascript.xml Modified files: /peardoc/en/package/html html-template-flexy.xml Log: finally some docs on tojavascript http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy.xml?r1=1.13&r2=1.14&ty=u Index: peardoc/en/package/html/html-template-flexy.xml diff -u peardoc/en/package/html/html-template-flexy.xml:1.13 peardoc/en/package/html/html-template-flexy.xml:1.14 --- peardoc/en/package/html/html-template-flexy.xml:1.13 Fri Jul 22 23:29:58 2005 +++ peardoc/en/package/html/html-template-flexy.xml Sat Jul 23 00:10:54 2005 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <sect1 id="package.html.html-template-flexy"> <title>HTML_Template_Flexy</title> @@ -53,6 +53,7 @@ <!-- &package.html.html-template-flexy.forms; --> + &package.html.html-template-flexy.attribute.form; &package.html.html-template-flexy.attribute.input; &package.html.html-template-flexy.attribute.textarea; @@ -66,20 +67,6 @@ &package.html.html-template-flexy.attribute.flexyignore; &package.html.html-template-flexy.attribute.nameuses; + <!-- &package.html.html-template-flexy.customtags; --> + &package.html.html-template-flexy.attribute.tojavascript; </sect1> -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -sgml-parent-document:nil -sgml-default-dtd-file:"../../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm= \ No newline at end of file http://cvs.php.net/co.php/peardoc/en/package/html/html-template-flexy/attribute/tojavascript.xml?r=1.1&p=1 Index: peardoc/en/package/html/html-template-flexy/attribute/tojavascript.xml +++ peardoc/en/package/html/html-template-flexy/attribute/tojavascript.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.attribute.tojavascript"> <refnamediv> <refname>&lt;FLEXY:TOJAVASCRIPT JSVAR=&quot;PHPVAR&quot;&gt; ...</refname> <refpurpose>Provides a simple way to pass data from PHP to Javascript</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef>&lt;<parameter>flexy:tojavascript JSVAR=&quot;PHPVAR&quot; ...</parameter>&gt;</paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.attribute.tojavascript.desc"> &title.desc; <para> To reduce the &quot;WTF&quot; effect of magically having javascript code that looks like flexy tags completely broken by the template engine, Flexy deliberatly turns the parser OFF when dealing with script contents (see Configuration Options for details of PHP in script tags) </para> <para> As a result of this, it is not possible to put any flexy tags within blocks of javascript code. the flexy:tojavascript tag solves this in a way that enables javascript to be tested seperatly from the application, and also serves to encourage better coding practices. (eg. seperating your code with distinct lines of communication) </para> <para> This feature depends on PEAR's HTML_Javascript Library </para> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.tojavascript.example"> &title.example; <example> <title>A template with javascript and flexy:tojavasscript</title> <programlisting role="php"><![CDATA[ <html><head> <title>Example</title> <flexy:toJavascript flexy:prefix="test_abc_" abcg="xyz" abcd="xyz" srcXxx="xyz" > <!-- We can use the inner contents for testing the template in a browser. The template will remove these contents when it is compiled. --> <script type="text/javascript"> var test_abc_abcg = '123'; var test_abc_abcd = '123'; var test_abc_srcXxx = '123'; </script> </flexy:toJavascript> <flexy:toJavascript abcg="xyz"> <script type="text/javascript"> var xyz = '123'; </script> </flexy:toJavascript> <body> <p>Example of flexy:toJavascript with default values.</p> </body></html> ]]> </programlisting> </example> <example> <title>compiled template</title> <programlisting role="php"> <![CDATA[ <html><head> <title>Example</title> <?php require_once 'HTML/Javascript/Convert.php';?> <script type='text/javascript'> <?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_abcg',true); echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?> <?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_abcd',true); echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?> <?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_srcXxx',true); echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?> </script> ?php require_once 'HTML/Javascript/Convert.php';?> <script type='text/javascript'> <?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'abcg',true); echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?> </script> <body> <p>Example of flexy:toJavascript with default values.</p> </body></html> ]]> </programlisting> </example> <example> <title>output from the Template (with no values set)</title> <programlisting role="html"> <![CDATA[ <html><head> <title>Example</title> <script type='text/javascript'> test_abc_abcg = null; test_abc_abcd = null; test_abc_srcXxx = null; </script> <script type='text/javascript'> abcg = null; </script> <body> <p>Example of flexy:toJavascript with default values.</p> </body></html> ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: sy

« previous php.pear.doc (#6559) next »