TAO sub theme

Events happening in the community are now at Drupal community events on www.drupal.org.
eYeCasH's picture

Hi,

I want to leave zen as base theme and go with tao.

I made a sub-theme from tao, but when i change the background of the #page in drupal.css i get this PHP error when I log in:

Notice: Undefined variable: primary_local_tasks in include() (line 42 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/page.tpl.php).
Notice: Undefined variable: secondary_local_tasks in include() (line 43 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/page.tpl.php).
Notice: Undefined variable: hook in include() (line 16 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 20 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 16 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 20 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 16 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 20 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 16 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).
Notice: Undefined variable: hook in include() (line 20 of /home/grinders/domains/grinders.be/public_html/sites/all/themes/mavia/templates/node.tpl.php).

the only thing I added was

page { background: #ccc; } in drupal.css

when I remove this I don't get the error.

When I search on Notice: Undefined variable: hook in include() here on drupal.org I don't find a solution for my problem. There are threads where people say that I have to edit my template.php file but I don't know why and how.

ThxX

Comments

The CSS has nothing to do

c4rl's picture

The CSS has nothing to do with your error.

The notices are thrown for the reason which they describe: You're using undefined variables in your page template. The reason you see the PHP errors (specifically notices) when you login is because you have error reporting turned on. PHP errors don't display for anonymous users.

PHP notices are not fatal, but you should fix them, read more about them here http://www.php.net/manual/en/book.errorfunc.php

Undefined Variables

eYeCasH's picture

Hey c4rl,

Thx for the fast response. I got the error after a fresh install of Tao.

These are the 2 lines from page.tpl.php that give notice:

Line 42:

<?php
if ($primary_local_tasks):
?>

<?php
endif;
?>

Line 43:

<?php
if ($secondary_local_tasks):
?>

<?php
endif;
?>

The undefined variables are $primary_local_tasks and $secondary_local_tasks

If I delete these 2 lines the problem is fixed and everything renders well, but i'm afraid I will get this in my face later on for removing these lines.

or is it good like this?

PHP notices are thrown

c4rl's picture

PHP notices are thrown because you are doing a boolean check on an uninitialized variable. Error reporting levels in php.ini will determine whether these notices appear or not. Generally they are not a big deal.

The best practice is to use empty() and isset() instead of pure boolean since they do not throw notices. See http://php.net/manual/en/types.comparisons.php for more information (Notice that empty() is the opposite of the boolean check and isset() is the opposite of is_null()).

Here's an example:

<?php
// if $foo resolves to boolean FALSE
if (empty($foo)) { ... }

// if $foo resolves to boolean TRUE
if (!empty($foo)) { ... }

// if $foo is NULL
if (!isset($foo)) { ... }

// if $foo is not NULL
if (isset($foo)) { ... }
?>

Theme development

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: