【发布时间】:2016-10-09 14:21:10
【问题描述】:
我自己编写了一个 CMS,直到 PHP 版本 5.6 之前它都可以正常工作。 现在,PHP7 开始了,我希望我的 CMS 为它做好准备。 在这个 CMS 中,我使用 PEAR 库,我已经升级到 1.1o 版,因为据说这个版本支持 PHP7。
现在我的包 HTML_Template_IT 出现以下问题:尝试加载模板文件时,然后 setCurrentBlock('meta-tags') 我收到消息“找不到此块”meta-tags'”
有没有人遇到同样的问题并且可以解决它? 非常感谢您的帮助!
这是我在 index.php 中的代码:
require_once('HTML/Template/ITX.php');
$tpl = new HTML_Template_ITX(TEMPLATE_DIR);
// Einlesen der Haupttemplate-Datei
$tpl->loadTemplatefile('main_tpl.html', true, true);
// Meta-Tags ausgeben
$tpl->setCurrentBlock('meta-tags');
$tpl->setVariable('author', AUTHOR);
$tpl->setVariable('description', DESCRIPTION);
$tpl->setVariable('keywords', KEYWORDS);
$tpl->setVariable('page_topic', PAGE_TOPIC);
$tpl->setVariable('publisher', PUBLISHER);
$tpl->setVariable('google_verify', GOOGLE_VERIFY);
$tpl->parseCurrentBlock();
这是我的模板文件 main_tpl.html 中的相应详细信息:
<!-- BEGIN meta-tags -->
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="{author}" />
<meta name="Content-Language" content="de" />
<meta name="description" content="{description}" />
<meta name="keywords" content="{keywords}" />
<meta name="page-topic" content="{page_topic}" />
<meta name="publisher" content="{publisher}" />
<meta name="google-site-verification" content="{google_verify}" />
<meta name="rating" content="general" />
<meta name="revisit-after" content="10 days" />
<meta name="robots" content="index, follow" />
<!-- END meta-tags -->
这是浏览器中的输出:
Cannot find this block"meta-tags'
【问题讨论】:
-
感谢您的解决方案 - 现在工作正常!