My watchdog gets a bunch of errors:
Notice: Undefined variable: base_path in genesis_theme() (line 24 of /Users/rcourtna/Projects/wpg/sites/all/themes/genesis/genesis/template.php).
Line 24 is:
include_once $base_path . drupal_get_path('theme', 'genesis') . '/template.conditional-styles.inc';
$base_path is not a variable available to the function. Should it be $GLOBALS['base_path'] ?
function genesis_theme(&$existing, $type, $theme, $path){
// Compute the conditional stylesheets.
if (!module_exists('conditional_styles')) {
include_once $base_path . drupal_get_path('theme', 'genesis') . '/template.conditional-styles.inc';
// _conditional_styles_theme() only needs to be run once.
if ($theme == 'genesis') {
_conditional_styles_theme($existing, $type, $theme, $path);
}
}
$templates = drupal_find_theme_functions($existing, array('phptemplate', $theme));
$templates += drupal_find_theme_templates($existing, '.tpl.php', $path);
return $templates;
}
Comments
Comment #1
ryan_courtnage commentedActually, after looking at this again, I'm not sure that "$base_path" has any business being in the include_once line. IMHO, it should look like:
Comment #2
yoroy commentedConfirming this issue. I get:
Comment #3
Jeff Burnz commentedbase_path is redundant and can ship out (committed to DEV) but the other undefined variables I can't reproduce, whats your environment yoroy, I'm running E_ALL as per normal and can't seem to trigger the notices in 6.x-2.4.
Just asking in case you know, but if the notice occurs on line 152 then why not again on lines 155 and 159? 152 is just there to add a conditional wrapper DIV (which IMO has turned out to be a bit redundant) and could be removed.
Note, in the DEV version I've changed the way the primary_menu/secondary_menu vars are built, to bring it inline with my other themes, I've been meaning to commit that for a long time, so maybe try the DEV version and see it you get the same issue although I'd really like to suss this out, its odd that I don't get the notices (Apache2/PHP5.2.12/Win7 and Apache2/PHP5.2.11/Ubuntu).
Comment #4
ryan_courtnage commentedJeff,
FYI, my Genesis_SUBTHEME subtheme was also giving undefined notices for $primary_menu and $secondary_menu. To eliminate, I added 'isset':
PHP 5.2.6
MAMP
E_ALL
Comment #5
Jeff Burnz commented@ryan - yes, that's the obvious solution, I still am baffled why you guys are getting the notices and I am not!
You can clean that up a bit...
Comment #6
marcvangendI'm getting a similar error after unchecking the logo check box at /admin/appearance/settings/genesis_mytheme:
However I do not really like 'the obvious solution' as Jeff calls it. First of all, there is a difference between
if (isset($site_logo) && $site_logo)andif (isset($site_logo)). See this example:All these isset() statements will make the .tpl.php more complex than needed, especially for new Drupal developers and people with limited php skills.
Instead, I think this should be solved in template.php. If you just initialize the variables like this:
Then you can be sure that the variables always set and you can keep using the simple
if ($site_logo)syntax.Comment #7
jpw1116 commentedIn D7 Alpha 4, on a very "Drupal friendly" hosting service, I *just* installed my first instance of a Genesis subtheme . . . yet can't even set the favicon.
It's identical to marcvangend's "Undefined variable . . . line 20" (through line 23) errors and I agree, this is complex for new Drupal developers. (Cue raised hand now!)
Is there any plan to prioritize an update?
Comment #8
Jeff Burnz commentedYeah for sure, just trying to find the time at the moment, been so busy on Bartik and Corolla for Drupal core, looks like my effort on those should be wrapping up soon so I can work on my own projects!
Comment #9
jpw1116 commentedGreat, thank you. I appreciate all the effort you have been making, no doubt!
Plus, I noticed that some of the checkboxes in the settings of the Genesis subtheme were not sticky. I was eventually able to reselect the right ones and get the default favicon to show, but still no custom one.
I'll continue to test out Genesis on 7 Alpha 4.
Comment #10
Jeff Burnz commentedSee what crops up, theres been a lot of changes in Drupal since I made the last commit for Genesis D7, so if quite out of date and lots of things to fix and repair.