2

私は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 で検索したところ、キャッシュをクリアすると問題が解決することがわかりました。しかし、キャッシュをクリアした後でも、同じままです!

4

4 に答える 4

6

page.tpl.php通常、これらのエラーは、テーマのファイルに存在しないファイル内の領域を呼び出すときに発生しました.info

あなたのpage.tpl.php

$page['footer_firstcolumn'];

あなたのテーマで.info

regions[footer_firstcolumn] = Footer first column

すべての地域を再確認した後、忘れずにflush the cache

于 2012-07-24T07:44:12.157 に答える
3

新しいテーマを作成する場合のベスト プラクティスは、 Zenなどを使用することです。それは空白で、完全にカスタマイズ可能です。

所定の指示に従う限り、上記のような厄介なエラーを回避できます

于 2012-07-23T14:36:03.287 に答える
1

サブテーマを作成した後も同じ問題が発生し、Meiker の回答に従ったところ、isset を含めることでうまくいきました。しかし、私はプログラミングの経験があまりないので、220行目と同じ行に複数のトリプティクがあることに遭遇しました。

Notice: 未定義のインデックス: include() の triptych_first (C:\wamp\www\dtest\sites\all\themes の 220 行目)

だから私はこのように isset を追加しました:

if(isset($page['triptych_first']) || (isset($page['triptych_middle']) || (isset($page['triptych_last'])))) :

同様のエラー行に対して同じことを行いましたが、これ以上エラーは表示されません。

これがプログラミングに挑戦している他の人に役立つことを願っています。

于 2015-04-29T16:20:05.453 に答える