mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
Added some examples. Hope it helps ;-)
This commit is contained in:
@@ -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
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user