mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09: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>
|
||||
<TITLE>Hello</TITLE>
|
||||
<BODY>
|
||||
Hello, {$Name}!
|
||||
Hello, {$Name}!
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -118,9 +118,9 @@ $smarty->display("./templates/index.tpl");
|
||||
<HTML>
|
||||
<TITLE>Hello</TITLE>
|
||||
<BODY>
|
||||
Hello, {$Name}!<br>
|
||||
{$FirstName}, {$LastName}<br>
|
||||
{$Address}, {$Zipcode}
|
||||
Hello, {$Name}!<br>
|
||||
{$FirstName}, {$LastName}<br>
|
||||
{$Address}, {$Zipcode}
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -143,10 +143,17 @@ require("Smarty.class.php");
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign("Name","Ned");
|
||||
$smarty->assign(array(
|
||||
<<<<<<< QUICKSTART
|
||||
"FirstName" => "Fred",
|
||||
"LastName" => "Flanders",
|
||||
"Address" => "Springfield"
|
||||
));
|
||||
=======
|
||||
"FirstName" => "Ned",
|
||||
"LastName" => "Flanders",
|
||||
"Address" => "Springfield"
|
||||
));
|
||||
>>>>>>> 1.2
|
||||
$zipcode = "55555";
|
||||
$smarty->assign("Zipcode",$zipcode);
|
||||
$smarty->display("./templates/index.tpl");
|
||||
@@ -155,9 +162,9 @@ $smarty->display("./templates/index.tpl");
|
||||
|
||||
--------- templates/index.tpl --------
|
||||
{include file="header.tpl" title="Home Page"}
|
||||
Hello, {$Name}!<br>
|
||||
{$FirstName}, {$LastName}<br>
|
||||
{$Address}, {$Zipcode}
|
||||
Hello, {$Name}!<br>
|
||||
{$FirstName}, {$LastName}<br>
|
||||
{$Address}, {$Zipcode}
|
||||
{include file="footer.tpl"}
|
||||
|
||||
--------- templates/header.tpl --------
|
||||
@@ -187,6 +194,18 @@ Example:
|
||||
|
||||
--------- templates/index.tpl --------
|
||||
{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 ""}
|
||||
Hello, Noname!<br>
|
||||
{elseif $Name eq "Ned"}
|
||||
@@ -197,6 +216,7 @@ Example:
|
||||
|
||||
{$FirstName}, {$LastName}<br>
|
||||
{$Address}, {$Zipcode}
|
||||
>>>>>>> 1.2
|
||||
{include file="footer.tpl"}
|
||||
|
||||
|
||||
@@ -219,13 +239,13 @@ $smarty->display("./templates/index.tpl");
|
||||
|
||||
--------- templates/index.tpl --------
|
||||
{include file="header.tpl" title="Home Page"}
|
||||
{section name=people loop=$FirstName}
|
||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||
{sectionelse}
|
||||
There are no values to loop through.
|
||||
{/section}
|
||||
<p>
|
||||
There were {%people.loop%} names in this list.
|
||||
{section name=people loop=$FirstName}
|
||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||
{sectionelse}
|
||||
There are no values to loop through.
|
||||
{/section}
|
||||
<p>
|
||||
There were {%people.loop%} names in this list.
|
||||
{include file="footer.tpl"}
|
||||
|
||||
|
||||
@@ -246,35 +266,35 @@ $smarty = new Smarty;
|
||||
$smarty->assign("FirstName",array("Ned","Bart","Montgomery"));
|
||||
$smarty->assign("LastName",array("Flanders","Simpson","Burns"));
|
||||
$smarty->assign("ContactNames",array(
|
||||
array("email","home","cell"),
|
||||
array("email","home"),
|
||||
array("email","home","fax")
|
||||
));
|
||||
array("email","home","cell"),
|
||||
array("email","home"),
|
||||
array("email","home","fax")
|
||||
));
|
||||
$smarty->assign("ContactVals",array(
|
||||
array("fred@simpsons.com","555-666-7777","555-444-3333"),
|
||||
array("bart@simpsons.com","555-111-2222"),
|
||||
array("monty@simpsons.com","555-888-9999","555-234-5678"),
|
||||
));
|
||||
array("fred@simpsons.com","555-666-7777","555-444-3333"),
|
||||
array("bart@simpsons.com","555-111-2222"),
|
||||
array("monty@simpsons.com","555-888-9999","555-234-5678"),
|
||||
));
|
||||
|
||||
$smarty->display("./templates/index.tpl");
|
||||
?>
|
||||
|
||||
--------- templates/index.tpl --------
|
||||
{include file="header.tpl" title="Home Page"}
|
||||
{section name=people loop=$FirstName}
|
||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||
{section name=contacts loop=$people/ContactNames}
|
||||
{* for fun, lets bold every other row *}
|
||||
{if %contacts.rownum% is even}<b>{/if}
|
||||
{$people/contacts/ContactNames}: {$people/contacts/ContactVals}<br>
|
||||
{if %contacts.rownum% is even}</b>{/if}
|
||||
{/section}
|
||||
<br>
|
||||
{sectionelse}
|
||||
There are no values to loop through.
|
||||
{/section}
|
||||
<p>
|
||||
There were {%people.loop%} names in this list.
|
||||
{section name=people loop=$FirstName}
|
||||
{%people.rownum%} {$people/FirstName} {$people/LastName}<br>
|
||||
{section name=contacts loop=$people/ContactNames}
|
||||
{* for fun, lets bold every other row *}
|
||||
{if %contacts.rownum% is even}<b>{/if}
|
||||
{$people/contacts/ContactNames}: {$people/contacts/ContactVals}<br>
|
||||
{if %contacts.rownum% is even}</b>{/if}
|
||||
{/section}
|
||||
<br>
|
||||
{sectionelse}
|
||||
There are no values to loop through.
|
||||
{/section}
|
||||
<p>
|
||||
There were {%people.loop%} names in this list.
|
||||
{include file="footer.tpl"}
|
||||
|
||||
|
||||
|
@@ -4,7 +4,8 @@
|
||||
* Project: Smarty: the PHP compiled template engine
|
||||
* File: Smarty.addons.php
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Andrei Zmievski <andrei@ispi.net>
|
||||
* parsing engine rewrite and a lot more
|
||||
* Version: 1.0
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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");
|
||||
|
||||
|
||||
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}
|
||||
|
||||
<PRE>
|
||||
|
||||
{* bold and title are read from the config file *}
|
||||
{if #bold#}<b>{/if}
|
||||
Title: {#title#|capitalize}
|
||||
{if #bold#}</b>{/if}
|
||||
|
||||
|
||||
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}
|
||||
|
||||
My interests are:
|
||||
@@ -22,16 +25,14 @@ My interests are:
|
||||
none
|
||||
{/section}
|
||||
|
||||
({$FirstName|@count})
|
||||
|
||||
{insert name=paginate}
|
||||
<p>
|
||||
|
||||
testing strip tags
|
||||
{strip}
|
||||
<table border=0>
|
||||
<tr>
|
||||
<td>
|
||||
<A HREF="{$url}">
|
||||
<A HREF="{$SCRIPT_NAME}">
|
||||
<font color="red">This is a test </font>
|
||||
</A>
|
||||
</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>.
|
||||
</para>
|
||||
</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>
|
||||
|
@@ -12,10 +12,4 @@ $smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
|
||||
|
||||
$smarty->display("./templates/index.tpl");
|
||||
|
||||
|
||||
function insert_paginate()
|
||||
{
|
||||
echo "test paginate\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Andrei Zmievski <andrei@ispi.net>
|
||||
* parsing engine rewrite and a lot more
|
||||
* Version: 1.0
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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}
|
||||
|
||||
<PRE>
|
||||
|
||||
{* bold and title are read from the config file *}
|
||||
{if #bold#}<b>{/if}
|
||||
Title: {#title#|capitalize}
|
||||
{if #bold#}</b>{/if}
|
||||
|
||||
|
||||
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}
|
||||
|
||||
My interests are:
|
||||
@@ -22,16 +25,14 @@ My interests are:
|
||||
none
|
||||
{/section}
|
||||
|
||||
({$FirstName|@count})
|
||||
|
||||
{insert name=paginate}
|
||||
<p>
|
||||
|
||||
testing strip tags
|
||||
{strip}
|
||||
<table border=0>
|
||||
<tr>
|
||||
<td>
|
||||
<A HREF="{$url}">
|
||||
<A HREF="{$SCRIPT_NAME}">
|
||||
<font color="red">This is a test </font>
|
||||
</A>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user