mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
added an example
This commit is contained in:
@@ -3,14 +3,14 @@
|
|||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>{php}</title>
|
<title>{php}</title>
|
||||||
<para>
|
<para>
|
||||||
{php} tags allow php to be embedded directly into the template. They
|
The {php} tags allow PHP code to be embedded directly into the template. They
|
||||||
will not be escaped, regardless of the <link
|
will not be escaped, regardless of the <link
|
||||||
linkend="variable.php.handling">$php_handling</link> setting. This
|
linkend="variable.php.handling">$php_handling</link> setting. This
|
||||||
is for advanced users only, not normally needed.
|
is for advanced users only, not normally needed and not recommended.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>{php} tags</title>
|
<title>{php} tags</title>
|
||||||
<programlisting role="php">
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{php}
|
{php}
|
||||||
// including a php script directly
|
// including a php script directly
|
||||||
@@ -30,15 +30,19 @@
|
|||||||
</note>
|
</note>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>{php} tags with global</title>
|
<title>{php} tags with global and assigning a variable</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{php}
|
{php}
|
||||||
global $foo, $bar;
|
global $foo, $bar;
|
||||||
if($foo == $bar){
|
if($foo == $bar){
|
||||||
// do something
|
echo 'This will come out in the template';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->assign('varX','Strawberry');
|
||||||
|
|
||||||
{/php}
|
{/php}
|
||||||
|
<strong>{$varX}</strong> is my fav ice cream
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
Reference in New Issue
Block a user