「Php/Smarty/smarty5」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→getterへ) |
|||
| 行4: | 行4: | ||
==smarty4から5へ== | ==smarty4から5へ== | ||
===setterへ=== | ===setterへ=== | ||
| − | + | 修正前 | |
| − | + | ||
<pre> | <pre> | ||
| − | $ | + | $smarty->cache_dir = '/path/to/cache'; |
| − | $ | + | $smarty->template_dir = '/path/to/templates'; |
| − | $ | + | $smarty->compile_dir = '/path/to/templates_c'; |
| + | $smarty->left_delimiter = '{{'; | ||
| + | $smarty->right_delimiter = '}}'; | ||
| + | </pre> | ||
| + | 修正後 | ||
| + | <pre> | ||
| + | $smarty->setCacheDir('/path/to/cache'); | ||
| + | $smarty->setTemplateDir('/path/to/templates'); | ||
| + | $smarty->setCompileDir('/path/to/templates_c'); | ||
| + | $smarty->setLeftDelimiter('{{''); | ||
| + | $smarty->setRightDelimiter('}}''); | ||
</pre> | </pre> | ||
===getterへ=== | ===getterへ=== | ||
| + | 修正前 | ||
| + | <pre> | ||
| + | $smarty->template_dir; | ||
| + | $smarty->compile_dir; | ||
| + | $smarty->cache_dir; | ||
| + | $smarty->left_delimiter; | ||
| + | $smarty->right_delimiter; | ||
| + | </pre> | ||
| + | 修正後 | ||
<pre> | <pre> | ||
| − | $smarty-> | + | $smarty->getTemplateDir(); |
| − | $smarty-> | + | $smarty->getCompileDir(); |
| − | $smarty-> | + | $smarty->getCacheDir(); |
| + | $smarty->getLeftDelimiter(); | ||
| + | $smarty->getRightDelimiter(); | ||
</pre> | </pre> | ||
2026年4月5日 (日) 07:07時点における版
smarty5のダウンロード
https://github.com/smarty-php/smarty/releases/tag/v5.8.0
smarty4から5へ
setterへ
修正前
$smarty->cache_dir = '/path/to/cache';
$smarty->template_dir = '/path/to/templates';
$smarty->compile_dir = '/path/to/templates_c';
$smarty->left_delimiter = '{{';
$smarty->right_delimiter = '}}';
修正後
$smarty->setCacheDir('/path/to/cache');
$smarty->setTemplateDir('/path/to/templates');
$smarty->setCompileDir('/path/to/templates_c');
$smarty->setLeftDelimiter('{{'');
$smarty->setRightDelimiter('}}'');
getterへ
修正前
$smarty->template_dir; $smarty->compile_dir; $smarty->cache_dir; $smarty->left_delimiter; $smarty->right_delimiter;
修正後
$smarty->getTemplateDir(); $smarty->getCompileDir(); $smarty->getCacheDir(); $smarty->getLeftDelimiter(); $smarty->getRightDelimiter();
use必須
new Smartyなどで、Smartyを使ってる箇所に以下を追加
use Smarty\Smarty;
