0
我有一個調用模板文件,並需要檢查文件中指定的參數的函數調用的文件裏面:在PHP中得到的參數從外部
注:只有縮短例子在這裏
裏面config.php(在一個類中) - 編輯:這應該檢查是否$echo
是true
並且它是否在模板中設置。
// Edit:
function check_cb()
{
// The {$echo} is meant to be from inside the template
if ($echo === TRUE AND $inside_template === TRUE)
return $whatever = 'Using {$echo} in a callback & from inside template is not allowed.'
return $whatever = 'Check: ok';
}
內的template.php(check_cb
被調用前)
$echo = FALSE;
$args = array(
'type' => 'input'
,'id' => 'input_template_UID'
,'label' => 'Input Template Label'
,'label_sep' => false
,'opt_name' => 'abc_xyz'
,'value' => 'test value'
);
example_function($args, $echo);
內的另一個類
問題的一部分:我怎樣才能得到的參數從一個文件裏面?它甚至有可能嗎? 增加:我也可以修改example_function()
,但目前我還沒有任何好的想法。
你是說我應該在每個模板中設置回顯全局?順便說一句:我更新了Q更清晰(第一個功能+解釋)。 – kaiser
噢,對不起:我以一種容易被誤解的方式編寫Q,並且信息太少 - 通過編輯來修復。 – kaiser