mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
Cleaned up some ws and another example
This commit is contained in:
@@ -69,30 +69,30 @@
|
|||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>{eval}</title>
|
<title>{eval}</title>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
setup.conf
|
#setup.conf
|
||||||
----------
|
#----------
|
||||||
|
emphstart = <strong>
|
||||||
emphstart = <strong>
|
emphend = </strong>
|
||||||
emphend = </strong>
|
title = Welcome to {$company}'s home page!
|
||||||
title = Welcome to {$company}'s home page!
|
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
|
||||||
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
|
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
|
||||||
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
|
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where the template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{config_load file="setup.conf"}
|
{config_load file='setup.conf'}
|
||||||
|
|
||||||
{eval var=$foo}
|
{eval var=$foo}
|
||||||
{eval var=#title#}
|
{eval var=#title#}
|
||||||
{eval var=#ErrorCity#}
|
{eval var=#ErrorCity#}
|
||||||
{eval var=#ErrorState# assign="state_error"}
|
{eval var=#ErrorState# assign='state_error'}
|
||||||
{$state_error}
|
{$state_error}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
@@ -100,14 +100,37 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
This is the contents of foo.
|
This is the contents of foo.
|
||||||
Welcome to Foobar Pub & Grill's home page!
|
Welcome to Foobar Pub & Grill's home page!
|
||||||
You must supply a <strong>city</strong>.
|
You must supply a <strong>city</strong>.
|
||||||
You must supply a <strong>state</strong>.
|
You must supply a <strong>state</strong>.
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Reference in New Issue
Block a user