Skip to content

Instantly share code, notes, and snippets.

@calpo
Created January 26, 2012 05:51
Show Gist options
  • Save calpo/1681248 to your computer and use it in GitHub Desktop.
Save calpo/1681248 to your computer and use it in GitHub Desktop.
SimplateでSmartyのinclude時に変数渡し相当の処理
pにアサインされた変数:{$p}
変数名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"}
<?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