theme template suggestions page node create php drupal drupal-7 drupal-theming drupal-themes

php - template - page-- node--



Error Drupal después de crear un nuevo tema, Variable indefinida: hide_site_name y otro error similar (4)

En general, estos errores se producen cuando llama a una región en su archivo page.tpl.php que no existe en el archivo .info del tema.

En su page.tpl.php :

$page[''footer_firstcolumn''];

En el tema .info :

regions[footer_firstcolumn] = Footer first column

Después de volver a verificar todas las regiones, no olvide flush the cache .

Soy nuevo en el tema drupal. mytheme.info un mytheme.info y agregué mytheme.info a él y copié otros archivos del directorio de temas predeterminado de drupal. Ahora, después de editar page.tpl.php , drupal muestra los siguientes errores.

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).

Después de buscar en google, descubrí que el caché de borrado resolverá el problema. ¡Pero incluso después de borrar mi caché, sigue siendo el mismo!


Si desea crear un tema nuevo, la mejor práctica es usar algo como Zen . Está en blanco y completamente personalizable.

Siempre que siga las instrucciones prescritas, evitará errores desagradables como los que tiene arriba


Tuve el mismo problema después de crear un subtema y seguí la respuesta de Meiker y funcionó muy bien al incluir isset. Pero como no tengo mucha experiencia en programación, me encontré con un problema con la línea 220 y un tríptico múltiple en la misma línea.

Aviso: índice indefinido: triptych_first en include () (línea 220 de C: / wamp / www / dtest / sites / all / themes

Así que agregué isset así:

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

e hice lo mismo con líneas de error similares y ahora ya no aparecen más errores.

Espero que esto ayude a otros que están desafiando la programación.


tuve casi el mismo problema con los mensajes que decían "Aviso: índice indefinido: myIndex en include () (línea n en some / path / myPage.tpl.php)" cuando estaba codificando mi sub-plantilla personalizada

Resolví el problema usando la función isset () de php para cada línea contada en el mensaje de Aviso.

Por ejemplo en tu línea 99 usaría:

if(isset(hide_site_name)){ //use hide_site_name in the normal way }

o en tu línea 168

if(isset( some_var[featured] )){ //use "featured" index in the normal way }

Espero que esto ayude a alguien, ya que esto me ayudó después de un largo tiempo en busca de una solución. nunca encontré la causa de este comportamiento por cierto. perdón por mala gramática, si hay alguna.