PHP define's do not work they way they do in C++. They are not part of a pre-processor, but instead actually evaluate like a function. Thus, the way the code is structured drupal_get_path() is running on every single page. It's better to put this "constant" in a function, and return it's value.

Also the full path to the include is not necessary. I frequently get PHP errors caused by this when using drush. I'm not sure exactly why this happens. But I know the solution is to not use the full path.

PHP Fatal error:  Cannot redeclare template_preprocess_views_view_views_rss() (previously declared in /users/me/Sites/mysite/sites/all/modules/contrib/views_rss/theme/theme.inc:11) in /Users/me/Sites/mysite/sites/all/modules/contrib/views_rss/theme/theme.inc on line 167
Files: 

Comments

Version:7.x-2.0-rc3» 7.x-2.x-dev
StatusFileSize
new2.44 KB

This basically the same patch for the 7.x-2.x-dev branch since the codebase differs.
I also removed absolute paths since they are not really needed.

Status:Needs review» Needs work

Replacing previous define of VIEWS_RSS_PATH with call to module_load_include() will not change anything in terms of efficiency, as module_load_include() uses drupal_get_path() too, so still it will be run on every page.

Also, perhaps the full path to the include was not necessary, but it is necessary in all other cases, as the module doesn't work anymore after removing it.