本文整理汇总了PHP中Render::checkTemplateFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::checkTemplateFile方法的具体用法?PHP Render::checkTemplateFile怎么用?PHP Render::checkTemplateFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::checkTemplateFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_index
function html_index($result)
{
if (Render::checkTemplateFile('home.index.tpl.php')) {
Backend::addContent(Render::file('home.index.tpl.php'));
} else {
Backend::add('Sub Title', 'Welcome');
Backend::addContent('<h3>Welcome to #Title#</h3><p>The code for this URL is in the Home Controller</p>');
}
return true;
}
示例2: hook_output
public static function hook_output($to_print)
{
Backend::add('BackendErrors', Backend::getError());
Backend::add('BackendSuccess', Backend::getSuccess());
Backend::add('BackendNotices', Backend::getNotice());
Backend::add('BackendInfo', Backend::getInfo());
Backend::setError();
Backend::setSuccess();
Backend::setNotice();
Backend::setInfo();
$content = Backend::getContent();
if (empty($content)) {
ob_start();
var_dump($to_print);
$content = ob_get_clean();
if (substr($content, 0, 4) != '<pre') {
$content = '<pre>' . $content . '</pre>';
}
Backend::addContent($content);
}
$layout = Backend::get('HTMLLayout', 'index');
if (!Render::checkTemplateFile($layout . '.tpl.php')) {
if (SITE_STATE != 'production') {
Backend::addError('Missing Layout ' . $layout);
}
$layout = 'index';
}
$to_print = Render::file($layout . '.tpl.php');
$to_print = self::addLastContent($to_print);
$to_print = self::replace($to_print);
$to_print = self::rewriteLinks($to_print);
$to_print = self::addLinks($to_print);
$to_print = self::formsAcceptCharset($to_print);
//TODO fix this
if (Component::isActive('BackendFilter')) {
$BEFilter = new BEFilterObj();
$BEFilter->read();
$filters = $BEFilter->list ? $BEFilter->list : array();
foreach ($filters as $row) {
if (class_exists($row['class'], true) && is_callable(array($row['class'], $row['function']))) {
$to_print = call_user_func(array($row['class'], $row['function']), $to_print);
}
}
}
//TODO Make this configurable
if (ConfigValue::get('html_view.TidyHTML') && function_exists('tidy_repair_string')) {
$to_print = tidy_repair_string($to_print);
}
return $to_print;
}
示例3: html_display
public function html_display($result)
{
if (!$result instanceof DBObject) {
return parent::html_display($result);
}
Backend::add('Sub Title', $result->array['name']);
$foreign_template = 'tag.' . class_for_url($result->array['foreign_table']);
$foreign_template .= '.list.tpl.php';
if (!Render::checkTemplateFile($foreign_template)) {
$foreign_template = 'tag.display.list.tpl.php';
}
Backend::add('tag_list_template', $foreign_template);
return parent::html_display($result);
}
示例4: html_import
public function html_import($result)
{
switch (true) {
case $result instanceof DBObject:
if (!Backend::get('Sub Title')) {
Backend::add('Sub Title', 'Import');
Backend::add('Sub Title', 'Import ' . $result->getMeta('name'));
}
$template_file = array($result->getArea() . '.import.tpl.php', $result->getArea() . '/import.tpl.php');
if (!Render::checkTemplateFile($template_file[0]) && !Render::checkTemplateFile($template_file[1])) {
$template_file = 'std_import.tpl.php';
}
Backend::addContent(Render::file($template_file, array('db_object' => $result)));
break;
case is_numeric($result) && $result >= 0:
Backend::addSuccess($result . ' records imported');
Controller::redirect('?q=' . Controller::$area . '/list');
break;
default:
Controller::redirect();
break;
}
return $result;
}
示例5: html_display
function html_display($content)
{
if ($content instanceof DBObject) {
Backend::add('Sub Title', $content->array['title']);
if ($content->array['from_file']) {
//Move this to the object ??
$filename = 'content/static/' . $content->array['name'] . '.html';
$template = 'content/' . $content->array['name'] . '.tpl.php';
if (Render::checkTemplateFile($template)) {
$content->object->body = Render::file($template);
} else {
if (file_exists(SITE_FOLDER . '/' . $filename)) {
$content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
} else {
if (file_exists(APP_FOLDER . '/' . $filename)) {
$content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
} else {
if (file_exists(BACKEND_FOLDER . '/' . $filename)) {
$content->object->body = file_get_contents(BACKEND_FOLDER . '/' . $filename);
//SITE FOLDER too?
}
}
}
}
}
$meta_desc = Backend::get('meta_description');
if (empty($meta_desc)) {
Backend::add('meta_description', plain(self::createPreview($content->object->body, false)));
}
$http_equiv = Backend::get('meta_http_equiv', array());
$http_equiv['Last-Modified'] = $content->object->modified;
Backend::add('meta_http_equiv', $http_equiv);
if (!headers_sent()) {
$max_age = ConfigValue::get('content.MaxAge', 86400);
header('Last-Modified: ' . $content->object->modified);
header('Expires: ' . gmdate('r', strtotime('+1 day')));
header('Cache-Control: max-age=' . $max_age . ', must-revalidate');
header('Pragma: cache');
}
}
if (Backend::getDB('default')) {
//TODO Make some of the content values (such as added and lastmodified) available
//So you can add Last Modified on #lastmodified# to the content.
$content = parent::html_display($content);
}
return $content;
}
示例6: array
<?php
$list_start = !isset($list_start) ? Controller::$parameters[1] : $list_start;
$list_length = !isset($list_length) ? Controller::$parameters[2] : $list_length;
?>
{tpl:std_search.tpl.php}
<?php
if (!empty($term)) {
?>
<p class="large">Showing results for the search for <strong>#term#</strong></p>
<?php
if (Render::checkTemplateFile($db_object->getArea() . '.list.tpl.php')) {
?>
<?php
echo Render::renderFile($db_object->getArea() . '.list.tpl.php', array('list_start' => $list_start, 'list_length' => $list_length));
?>
<?php
} else {
?>
{tpl:std_list.tpl.php}
<?php
}
}