Added some examples. Hope it helps ;-)

This commit is contained in:
pete_morgan
2006-03-13 03:07:09 +00:00
parent 3a8d0a996d
commit aff1b359f1
2 changed files with 47 additions and 9 deletions

View File

@@ -53,7 +53,26 @@ function foo() {
</screen>
</example>
<para>See also <link linkend="language.escaping">Escaping Smarty Parsing</link> </para>
<example>
<title>another Javascript example</title>
<programlisting>
<![CDATA[
<script language="JavaScript" type="text/javascript">
function myJsFunction(){ldelim}
alert("The server name\n{$smarty.server.SERVER_NAME}\n{$smarty.server.SERVER_ADDR}");
{rdelim}
</script>
<a href="javascript:myJsFunction()">Click here for Server Info</a>
]]>
</programlisting>
</example>
<para>See also
<link linkend="language.function.literal">{literal}</link>
and
<link linkend="language.escaping">Escaping Smarty Parsing</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -38,26 +38,45 @@
</example>
<example>
<title>Javascript = ecma</title>
<title>Javascript function example</title>
<programlisting>
<![CDATA[
<![CDATA[
<script language="JavaScript" type="text/javascript">
{literal}
function myJsFunction(name){
if(name){
alert('The servers name is: ' + name);
}
return false;
function myJsFunction(name, ip){
alert("The server name\n" + name + "\n" + ip);
}
{/literal}
</script>
<a href="javascript:myJsFunction('{$smarty.server.SERVER_NAME}')">Click here for Server Name</a>
<a href="javascript:myJsFunction('{$smarty.server.SERVER_NAME}','{$smarty.server.SERVER_ADDR}')">Click here for the Server Info</a>
]]>
</programlisting>
</example>
<example>
<title>Some css in a template</title>
<programlisting>
<![CDATA[
{* included this style .. as an experiment *}
<style type="text/css">
{literal}
/* this is an intersting idea for this section */
.madIdea{
border: 3px outset #ffffff;
margin: 2 3 4 5px;
background-color: #001122;
}
{/literal}
</style>
<div class="madIdea">With smarty you can embed css in the template</div>
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.ldelim">{ldelim} {rdelim}</link>
and
<link linkend="language.escaping">Escaping Smarty Parsing</link>.
</para>
</sect1>