Created
March 22, 2012 09:50
-
-
Save k-holy/2157414 to your computer and use it in GitHub Desktop.
Smarty3で文字列をテンプレートに
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title><Hello X'SS!></title> | |
</head> | |
<body> | |
<h1><Hello X'SS!></h1> | |
</body> | |
</html> |
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
<?php | |
require_once realpath(__DIR__ . '/../vendor/Smarty/libs/Smarty.class.php'); | |
$smarty = new Smarty(); | |
$smarty->assign('title', '<Hello X\'SS!>'); | |
echo $smarty->fetch('string: | |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>{$title|escape}</title> | |
</head> | |
<body> | |
<h1>{$title|escape}</h1> | |
</body> | |
</html>' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment