本文整理汇总了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;
}