本文整理匯總了PHP中Tpl::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tpl::get方法的具體用法?PHP Tpl::get怎麽用?PHP Tpl::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tpl
的用法示例。
在下文中一共展示了Tpl::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generate_graminfo_files
function generate_graminfo_files($outDir)
{
$tpl = new Tpl(dirname(__FILE__) . '/tpl');
$storage_ary = array('File', 'Mem', 'Shm');
$tpl = new Tpl(dirname(__FILE__) . '/tpl');
$helper_class = "Helper";
foreach ($storage_ary as $storage_name) {
$storage_class = "StorageHelper_" . ucfirst($storage_name);
$helper = new $helper_class($tpl, new $storage_class());
$result = $tpl->get('graminfo', array('helper' => $helper));
$file_name = "{$outDir}/graminfo_" . strtolower($storage_name) . '.php';
file_put_contents($file_name, $result);
unset($helper);
}
}
示例2: exec
public function exec()
{
if (!empty($this->_controller_name) && !empty($this->_controller_action)) {
//Call given controller and its action
$controller = new $this->_controller_name($this);
$controller->__init();
$reflectionClass = new \ReflectionClass($this->_controller_name);
$reflectionMethod = $reflectionClass->getMethod($this->_controller_action);
$parameters = [];
//Check parameters
foreach ($reflectionMethod->getParameters() as $param) {
if (isset($this->_post_params[$param->name])) {
$parameters[] = $this->_post_params[$param->name];
} else {
if (isset($this->_get_params[$param->name])) {
$parameters[] = $this->_get_params[$param->name];
} else {
if (isset($this->_put_params[$param->name])) {
$parameters[] = $this->_put_params[$param->name];
} else {
if ($param->isOptional()) {
$parameters[] = $param->getDefaultValue();
} else {
$parameters[] = null;
}
}
}
}
}
$returnValue = $controller->__before();
if ($returnValue !== false) {
$returnValue = $reflectionMethod->invokeArgs($controller, $parameters);
if ($returnValue !== false) {
$controller->__after();
}
}
if (!$this->_response->isRaw()) {
$this->_response->prepend(Tpl::get($controller->getHeaderViewPath() . '/header'));
$this->_response->append(Tpl::get($controller->getFooterViewPath() . '/footer'));
}
}
return $this;
}