facebook twitter hatena line email

「Php/Smarty/smarty5」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(getterへ)
行4: 行4:
 
==smarty4から5へ==
 
==smarty4から5へ==
 
===setterへ===
 
===setterへ===
$smarty->cache_dir、$smarty->template_dir、$smarty->compile_dir への設定をそれぞれ変更。
+
修正前
 
+
 
<pre>
 
<pre>
$this->setCacheDir('/path/to/cache');
+
$smarty->cache_dir = '/path/to/cache';
$this->setTemplateDir('/path/to/templates');
+
$smarty->template_dir = '/path/to/templates';
$this->setCompileDir('/path/to/templates_c');
+
$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->template_dir; $smarty->getTemplateDir();
+
$smarty->getTemplateDir();
$smarty->compile_dir を $smarty->getCompileDir();
+
$smarty->getCompileDir();
$smarty->cache_dir を $smarty->getCacheDir();
+
$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;