I receive this error message in my pages; strange enough, it doesn't appear in the front page.

Notice: Undefined index: $base_path in include() (line 7 of /home/kinderen/kinderenenislam.nl/sites/all/themes/kei2/page--front.tpl.php).

Where should I include $base_path?

  • Sorry if I'm missing something here, but you say you're not receiving the error message in your front page and yet the error message cites 'page--front.tpl.php' as the source of the error (which will be the page template used for the front page). Can you clarify that?
    – Clive
    Apr 25 '12 at 7:58
  • I created a new theme, probably I'm missing something in my theme. I receive this error message in each page except the Front page
    – wallace740
    Apr 25 '12 at 8:06

$base_path is a global variable which should definitely be available in your theme's page template files.

I would guess your theme is doing something to remove that var (perhaps in a preprocess function). You can easily solve the problem using one of the following:

  1. Using a call to the base_path() function instead of $base_path.
  2. Using $GLOBALS['base_path'] in place of$base_path`.
  3. Adding the line <?php global $base_path; ?> to the top of your page template file(s)
  • Thx @Clive, number 1 was my solution
    – wallace740
    Apr 25 '12 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.