mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
Cleaned up some ws and another example
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user