2
votes

Please help me again! I have problems with this code:

<?php
  $pathThemes = INC_DIR . "themes";
  $d = dir($pathThemes);
  while (false !== ($entry = $d->read())) {
    $fileInfo = pathinfo($pathThemes . '/' . $entry);

    if ('php' == $fileInfo['extension']) {
      include_once($pathThemes . '/' . $entry);
      $name = $fileInfo['filename'];
      if (!$GLOBALS['fc_config']['themes'][$name]['name']) {
        unset($GLOBALS['fc_config']['themes'][$name]);
      }
    }
  }
?>

It says me:

Notice: Undefined index: name in C:\wamp\www\FlashChat_v607\chat\inc\include_themes.php on line 10

Notice: Undefined index: name in C:\wamp\www\FlashChat_v607\chat\inc\include_themes.php on line 10

Notice: Undefined index: name in C:\wamp\www\FlashChat_v607\chat\inc\include_themes.php on line 10

Notice: Undefined index: name in C:\wamp\www\FlashChat_v607\chat\inc\include_themes.php on line 10

3
FYI, since it seems that you got an answer that you liked to your previous question, you should go back and "accept" it by clicking the checkmark next to the answer that worked.Tyler McHenry

3 Answers

2
votes

try using isset( $GLOBALS['fc_config']['themes'][$name]['name'] ) with the not

2
votes
if (!isset($GLOBALS['fc_config']['themes'][$name]['name'])) {

take a look at the isset function

1
votes

Try this:

  if (!empty($name) && isset($GLOBALS['fc_config']['themes'][$name]['name'])) {
    unset($GLOBALS['fc_config']['themes'][$name]);
  }