-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aleksandr-ru
committed
Aug 9, 2016
1 parent
9bfa9de
commit 5e36906
Showing
2 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,17 +1,33 @@ | ||
<?php | ||
//header("content-type: text/plain"); | ||
require('../TemplateObject.php'); | ||
$to = new TemplateObject(); | ||
$to->loadTemplate('multifilter.html'); | ||
//$to = new TemplateObject(); | ||
//$to->loadTemplate('multifilter.html'); | ||
$to = TemplateObject::loadTemplate('multifilter.html'); | ||
$to->setVariable('TITLE', "Multiple filter test"); | ||
|
||
$string = "This a string with \"quotes\" and several lines\nsecond line\nthitd line"; | ||
$to->setVariable('VAR', $string); | ||
|
||
$to->addFilter('wrongfilter', function($a){ return 'wrong! '.$a; }); | ||
$to->removeFilter('raw'); | ||
$to->addFilter('html', 'htmlentities', TRUE); | ||
$to->addFilter('html', 'html_cb', TRUE); | ||
$to->addFilter('html2', 'html2_cb'); | ||
|
||
for($i=1; $i<=3; $i++) { | ||
$b = $to->setBlock('block1'); | ||
$b->setVariable('VAR', $string); | ||
} | ||
|
||
$to->showOutput(); | ||
|
||
function html_cb($a) | ||
{ | ||
return '<font color=red>' . htmlentities($a) . '</font>'; | ||
} | ||
|
||
function html2_cb($a) | ||
{ | ||
return '<font color=green>' . htmlentities($a) . '</font>'; | ||
} | ||
?> |