mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
update changes
This commit is contained in:
92
QUICKSTART
92
QUICKSTART
@@ -63,7 +63,7 @@ $smarty->display("./templates/index.tpl");
|
|||||||
<HTML>
|
<HTML>
|
||||||
<TITLE>Hello</TITLE>
|
<TITLE>Hello</TITLE>
|
||||||
<BODY>
|
<BODY>
|
||||||
Hello, {$Name}!
|
Hello, {$Name}!
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ $smarty->display("./templates/index.tpl");
|
|||||||
<HTML>
|
<HTML>
|
||||||
<TITLE>Hello</TITLE>
|
<TITLE>Hello</TITLE>
|
||||||
<BODY>
|
<BODY>
|
||||||
Hello, {$Name}!<br>
|
Hello, {$Name}!<br>
|
||||||
{$FirstName}, {$LastName}<br>
|
{$FirstName}, {$LastName}<br>
|
||||||
{$Address}, {$Zipcode}
|
{$Address}, {$Zipcode}
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
|
|
||||||
@@ -143,10 +143,17 @@ require("Smarty.class.php");
|
|||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign("Name","Ned");
|
$smarty->assign("Name","Ned");
|
||||||
$smarty->assign(array(
|
$smarty->assign(array(
|
||||||
|
<<<<<<< QUICKSTART
|
||||||
|
"FirstName" => "Fred",
|
||||||
|
"LastName" => "Flanders",
|
||||||
|
"Address" => "Springfield"
|
||||||
|
));
|
||||||
|
=======
|
||||||
"FirstName" => "Ned",
|
"FirstName" => "Ned",
|
||||||
"LastName" => "Flanders",
|
"LastName" => "Flanders",
|
||||||
"Address" => "Springfield"
|
"Address" => "Springfield"
|
||||||
));
|
));
|
||||||
|
>>>>>>> 1.2
|
||||||
$zipcode = "55555";
|
$zipcode = "55555";
|
||||||
$smarty->assign("Zipcode",$zipcode);
|
$smarty->assign("Zipcode",$zipcode);
|
||||||
$smarty->display("./templates/index.tpl");
|
$smarty->display("./templates/index.tpl");
|
||||||
@@ -155,9 +162,9 @@ $smarty->display("./templates/index.tpl");
|
|||||||
|
|
||||||
--------- templates/index.tpl --------
|
--------- templates/index.tpl --------
|
||||||
{include file="header.tpl" title="Home Page"}
|
{include file="header.tpl" title="Home Page"}
|
||||||
Hello, {$Name}!<br>
|
Hello, {$Name}!<br>
|
||||||
{$FirstName}, {$LastName}<br>
|
{$FirstName}, {$LastName}<br>
|
||||||
{$Address}, {$Zipcode}
|
{$Address}, {$Zipcode}
|
||||||
{include file="footer.tpl"}
|
{include file="footer.tpl"}
|
||||||
|
|
||||||
--------- templates/header.tpl --------
|
--------- templates/header.tpl --------
|
||||||
@@ -187,6 +194,18 @@ Example:
|
|||||||
|
|
||||||
--------- templates/index.tpl --------
|
--------- templates/index.tpl --------
|
||||||
{include file="header.tpl" title="Home Page"}
|
{include file="header.tpl" title="Home Page"}
|
||||||
|
<<<<<<< QUICKSTART
|
||||||
|
{if $Name eq ""}
|
||||||
|
Hello, Noname!<br>
|
||||||
|
{elseif $Name eq "Fred"}
|
||||||
|
Hello, Frederick!<br>
|
||||||
|
{else}
|
||||||
|
Hello, {$Name}<br>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{$FirstName}, {$LastName}<br>
|
||||||
|
{$Address}, {$Zipcode}
|
||||||
|
=======
|
||||||
{if $Name eq ""}
|
{if $Name eq ""}
|
||||||
Hello, Noname!<br>
|
Hello, Noname!<br>
|
||||||
{elseif $Name eq "Ned"}
|
{elseif $Name eq "Ned"}
|
||||||
@@ -197,6 +216,7 @@ Example:
|
|||||||
|
|
||||||
{$FirstName}, {$LastName}<br>
|
{$FirstName}, {$LastName}<br>
|
||||||
{$Address}, {$Zipcode}
|
{$Address}, {$Zipcode}
|
||||||
|
>>>>>>> 1.2
|
||||||
{include file="footer.tpl"}
|
{include file="footer.tpl"}
|
||||||
|
|
||||||
|
|
||||||
@@ -219,13 +239,13 @@ $smarty->display("./templates/index.tpl");
|
|||||||
|
|
||||||
--------- templates/index.tpl --------
|
--------- templates/index.tpl --------
|
||||||
{include file="header.tpl" title="Home Page"}
|
{include file="header.tpl" title="Home Page"}
|
||||||
{section name=people loop=$FirstName}
|
{section name=people loop=$FirstName}
|
||||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
There are no values to loop through.
|
There are no values to loop through.
|
||||||
{/section}
|
{/section}
|
||||||
<p>
|
<p>
|
||||||
There were {%people.loop%} names in this list.
|
There were {%people.loop%} names in this list.
|
||||||
{include file="footer.tpl"}
|
{include file="footer.tpl"}
|
||||||
|
|
||||||
|
|
||||||
@@ -246,35 +266,35 @@ $smarty = new Smarty;
|
|||||||
$smarty->assign("FirstName",array("Ned","Bart","Montgomery"));
|
$smarty->assign("FirstName",array("Ned","Bart","Montgomery"));
|
||||||
$smarty->assign("LastName",array("Flanders","Simpson","Burns"));
|
$smarty->assign("LastName",array("Flanders","Simpson","Burns"));
|
||||||
$smarty->assign("ContactNames",array(
|
$smarty->assign("ContactNames",array(
|
||||||
array("email","home","cell"),
|
array("email","home","cell"),
|
||||||
array("email","home"),
|
array("email","home"),
|
||||||
array("email","home","fax")
|
array("email","home","fax")
|
||||||
));
|
));
|
||||||
$smarty->assign("ContactVals",array(
|
$smarty->assign("ContactVals",array(
|
||||||
array("fred@simpsons.com","555-666-7777","555-444-3333"),
|
array("fred@simpsons.com","555-666-7777","555-444-3333"),
|
||||||
array("bart@simpsons.com","555-111-2222"),
|
array("bart@simpsons.com","555-111-2222"),
|
||||||
array("monty@simpsons.com","555-888-9999","555-234-5678"),
|
array("monty@simpsons.com","555-888-9999","555-234-5678"),
|
||||||
));
|
));
|
||||||
|
|
||||||
$smarty->display("./templates/index.tpl");
|
$smarty->display("./templates/index.tpl");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--------- templates/index.tpl --------
|
--------- templates/index.tpl --------
|
||||||
{include file="header.tpl" title="Home Page"}
|
{include file="header.tpl" title="Home Page"}
|
||||||
{section name=people loop=$FirstName}
|
{section name=people loop=$FirstName}
|
||||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||||
{section name=contacts loop=$people/ContactNames}
|
{section name=contacts loop=$people/ContactNames}
|
||||||
{* for fun, lets bold every other row *}
|
{* for fun, lets bold every other row *}
|
||||||
{if %contacts.rownum% is even}<b>{/if}
|
{if %contacts.rownum% is even}<b>{/if}
|
||||||
{$people/contacts/ContactNames}: {$people/contacts/ContactVals}<br>
|
{$people/contacts/ContactNames}: {$people/contacts/ContactVals}<br>
|
||||||
{if %contacts.rownum% is even}</b>{/if}
|
{if %contacts.rownum% is even}</b>{/if}
|
||||||
{/section}
|
{/section}
|
||||||
<br>
|
<br>
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
There are no values to loop through.
|
There are no values to loop through.
|
||||||
{/section}
|
{/section}
|
||||||
<p>
|
<p>
|
||||||
There were {%people.loop%} names in this list.
|
There were {%people.loop%} names in this list.
|
||||||
{include file="footer.tpl"}
|
{include file="footer.tpl"}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* Project: Smarty: the PHP compiled template engine
|
* Project: Smarty: the PHP compiled template engine
|
||||||
* File: Smarty.addons.php
|
* File: Smarty.addons.php
|
||||||
* Author: Monte Ohrt <monte@ispi.net>
|
* Author: Monte Ohrt <monte@ispi.net>
|
||||||
* Andrei Zmievski <andrei@ispi.net>
|
* Andrei Zmievski <andrei@ispi.net>
|
||||||
|
* Version: 1.0
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Andrei Zmievski <andrei@ispi.net>
|
* Andrei Zmievski <andrei@ispi.net>
|
||||||
* parsing engine rewrite and a lot more
|
* parsing engine rewrite and a lot more
|
||||||
|
* Version: 1.0
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@@ -12,10 +12,4 @@ $smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
|
|||||||
|
|
||||||
$smarty->display("./templates/index.tpl");
|
$smarty->display("./templates/index.tpl");
|
||||||
|
|
||||||
|
|
||||||
function insert_paginate()
|
|
||||||
{
|
|
||||||
echo "test paginate\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
{config_load file=test.conf section="my foo"}
|
{config_load file=test.conf section="setup"}
|
||||||
{include file=header.tpl title=foo}
|
{include file=header.tpl title=foo}
|
||||||
|
|
||||||
<PRE>
|
<PRE>
|
||||||
|
|
||||||
|
{* bold and title are read from the config file *}
|
||||||
|
{if #bold#}<b>{/if}
|
||||||
Title: {#title#|capitalize}
|
Title: {#title#|capitalize}
|
||||||
|
{if #bold#}</b>{/if}
|
||||||
|
|
||||||
|
|
||||||
the value of $SCRIPT_NAME is {$SCRIPT_NAME}
|
the value of $SCRIPT_NAME is {$SCRIPT_NAME}
|
||||||
|
|
||||||
{* A simple variable test *}
|
{* A simple variable test. print $Name in uppercase *}
|
||||||
hello, my name is {$Name|upper}
|
hello, my name is {$Name|upper}
|
||||||
|
|
||||||
My interests are:
|
My interests are:
|
||||||
@@ -22,16 +25,14 @@ My interests are:
|
|||||||
none
|
none
|
||||||
{/section}
|
{/section}
|
||||||
|
|
||||||
({$FirstName|@count})
|
<p>
|
||||||
|
|
||||||
{insert name=paginate}
|
|
||||||
|
|
||||||
testing strip tags
|
testing strip tags
|
||||||
{strip}
|
{strip}
|
||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<A HREF="{$url}">
|
<A HREF="{$SCRIPT_NAME}">
|
||||||
<font color="red">This is a test </font>
|
<font color="red">This is a test </font>
|
||||||
</A>
|
</A>
|
||||||
</td>
|
</td>
|
||||||
|
9
doc.sgm
9
doc.sgm
@@ -1762,4 +1762,13 @@ is the first week that has at least 4 days in the current year, and with Monday
|
|||||||
<link linkend="variable.modifiers">modifiers</link>.
|
<link linkend="variable.modifiers">modifiers</link>.
|
||||||
</para>
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
<chapter id="credits">
|
||||||
|
<title>CREDITS</title>
|
||||||
|
<para>
|
||||||
|
Monte Ohrt: Original idea an initial implementation, wrote the documentation.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Andrei Zmievski: Rewrote parser from scratch, added much functionality.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
</book>
|
</book>
|
||||||
|
@@ -12,10 +12,4 @@ $smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
|
|||||||
|
|
||||||
$smarty->display("./templates/index.tpl");
|
$smarty->display("./templates/index.tpl");
|
||||||
|
|
||||||
|
|
||||||
function insert_paginate()
|
|
||||||
{
|
|
||||||
echo "test paginate\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Andrei Zmievski <andrei@ispi.net>
|
* Andrei Zmievski <andrei@ispi.net>
|
||||||
* parsing engine rewrite and a lot more
|
* parsing engine rewrite and a lot more
|
||||||
|
* Version: 1.0
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
{config_load file=test.conf section="my foo"}
|
{config_load file=test.conf section="setup"}
|
||||||
{include file=header.tpl title=foo}
|
{include file=header.tpl title=foo}
|
||||||
|
|
||||||
<PRE>
|
<PRE>
|
||||||
|
|
||||||
|
{* bold and title are read from the config file *}
|
||||||
|
{if #bold#}<b>{/if}
|
||||||
Title: {#title#|capitalize}
|
Title: {#title#|capitalize}
|
||||||
|
{if #bold#}</b>{/if}
|
||||||
|
|
||||||
|
|
||||||
the value of $SCRIPT_NAME is {$SCRIPT_NAME}
|
the value of $SCRIPT_NAME is {$SCRIPT_NAME}
|
||||||
|
|
||||||
{* A simple variable test *}
|
{* A simple variable test. print $Name in uppercase *}
|
||||||
hello, my name is {$Name|upper}
|
hello, my name is {$Name|upper}
|
||||||
|
|
||||||
My interests are:
|
My interests are:
|
||||||
@@ -22,16 +25,14 @@ My interests are:
|
|||||||
none
|
none
|
||||||
{/section}
|
{/section}
|
||||||
|
|
||||||
({$FirstName|@count})
|
<p>
|
||||||
|
|
||||||
{insert name=paginate}
|
|
||||||
|
|
||||||
testing strip tags
|
testing strip tags
|
||||||
{strip}
|
{strip}
|
||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<A HREF="{$url}">
|
<A HREF="{$SCRIPT_NAME}">
|
||||||
<font color="red">This is a test </font>
|
<font color="red">This is a test </font>
|
||||||
</A>
|
</A>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user