我是 drupal 主题的新手。我创建了一个目录 mytheme
并向其中添加了 mytheme.info
并从 drupal 的默认主题目录复制了其他文件。现在编辑 page.tpl.php
后,drupal 显示以下错误。
Notice: Undefined variable: hide_site_name in include() (line 99 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined variable: hide_site_name in include() (line 109 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: featured in include() (line 168 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: highlighted in include() (line 187 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: sidebar_second in include() (line 212 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: triptych_first in include() (line 220 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: triptych_middle in include() (line 220 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: triptych_last in include() (line 220 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: footer_firstcolumn in include() (line 230 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: footer_secondcolumn in include() (line 230 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: footer_thirdcolumn in include() (line 230 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
Notice: Undefined index: footer_fourthcolumn in include() (line 230 of C:\wamp\www\dtest\sites\all\themes\mytheme\bartik\templates\page.tpl.php).
经过google搜索,发现清除缓存即可解决问题。但即使在清除我的缓存之后,它仍然是一样的!
最佳答案
通常,当您在 page.tpl.php
文件中调用主题的 .info
文件中不存在的区域时,就会发生这些错误。
在你的page.tpl.php
中:
$page['footer_firstcolumn'];
在您主题的 .info
中:
regions[footer_firstcolumn] = Footer first column
重新检查所有区域后,不要忘记刷新缓存
。
关于php - 创建新主题后出现 Drupal 错误, undefined variable : hide_site_name and other similar error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11611842/