Created
January 26, 2012 05:51
-
-
Save calpo/1681248 to your computer and use it in GitHub Desktop.
SimplateでSmartyのinclude時に変数渡し相当の処理
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
pにアサインされた変数:{$p} |
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
変数名pに$new_paramをアサイン | |
{assign_param('p', $new_param, $this)} | |
{include file="_tile.phtml"} | |
なおヘルパーなしの場合はこんな感じ | |
{php} | |
$this->assign('p', $this->_tpl_vars['new_param']); | |
{/php} | |
{include file="_tile.phtml"} |
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 | |
function assign_param($key, $data, $tpl) | |
{ | |
$tpl->assign($key, $data); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment