Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Smarty: Improved tokenization (#3268)
- Loading branch information
1 parent
7bcc5da
commit acc0bc0
Showing
15 changed files
with
885 additions
and
140 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{php} | ||
// including a php script directly from the template. | ||
include('/path/to/display_weather.php'); | ||
{/php} | ||
|
||
{* this template includes a {php} block that assign's the variable $varX *} | ||
{php} | ||
global $foo, $bar; | ||
if($foo == $bar){ | ||
echo 'This will be sent to browser'; | ||
} | ||
// assign a variable to Smarty | ||
$this->assign('varX','Toffee'); | ||
{/php} | ||
{* output the variable *} | ||
<strong>{$varX}</strong> is my fav ice cream :-) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["smarty", [ | ||
["embedded-php", [ | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "php"], | ||
["delimiter", "}"] | ||
]], | ||
["php", [ | ||
["comment", "// including a php script directly from the template."], | ||
|
||
["keyword", "include"], | ||
["punctuation", "("], | ||
["string", "'/path/to/display_weather.php'"], | ||
["punctuation", ")"], | ||
["punctuation", ";"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{/"], | ||
["keyword", "php"], | ||
["delimiter", "}"] | ||
]] | ||
]] | ||
]], | ||
|
||
["smarty", [ | ||
["comment", "{* this template includes a {php} block that assign's the variable $varX *}"] | ||
]], | ||
|
||
["smarty", [ | ||
["embedded-php", [ | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "php"], | ||
["delimiter", "}"] | ||
]], | ||
["php", [ | ||
["keyword", "global"], | ||
["variable", "$foo"], | ||
["punctuation", ","], | ||
["variable", "$bar"], | ||
["punctuation", ";"], | ||
|
||
["keyword", "if"], | ||
["punctuation", "("], | ||
["variable", "$foo"], | ||
["operator", "=="], | ||
["variable", "$bar"], | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
|
||
["keyword", "echo"], | ||
["string", "'This will be sent to browser'"], | ||
["punctuation", ";"], | ||
|
||
["punctuation", "}"], | ||
|
||
["comment", "// assign a variable to Smarty"], | ||
|
||
["variable", "$this"], | ||
["operator", "->"], | ||
["function", ["assign"]], | ||
["punctuation", "("], | ||
["string", "'varX'"], | ||
["punctuation", ","], | ||
["string", "'Toffee'"], | ||
["punctuation", ")"], | ||
["punctuation", ";"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{/"], | ||
["keyword", "php"], | ||
["delimiter", "}"] | ||
]] | ||
]] | ||
]], | ||
|
||
["smarty", [ | ||
["comment", "{* output the variable *}"] | ||
]], | ||
|
||
["tag", [ | ||
["tag", [ | ||
["punctuation", "<"], | ||
"strong" | ||
]], | ||
["punctuation", ">"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["variable", "$varX"], | ||
["delimiter", "}"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "</"], | ||
"strong" | ||
]], | ||
["punctuation", ">"] | ||
]], | ||
" is my fav ice cream :-)" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{if false} | ||
{if off} | ||
{if on} | ||
{if no} | ||
{if true} | ||
{if yes} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "false"], | ||
["delimiter", "}"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "off"], | ||
["delimiter", "}"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "on"], | ||
["delimiter", "}"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "no"], | ||
["delimiter", "}"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "true"], | ||
["delimiter", "}"] | ||
]], | ||
["smarty", [ | ||
["delimiter", "{"], | ||
["keyword", "if"], | ||
["boolean", "yes"], | ||
["delimiter", "}"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for keywords. |
Oops, something went wrong.