2

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

1
  • 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. Commented May 18, 2010 at 20:19

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

10 Comments

@Marin: isset works differently for you than everyone else? Prove it. Post the new 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']) { !isset( $GLOBALS['fc_config']['themes'][$name]['name'] ) } } } ?>
Marin: First of all, calm down. Second, put the code you tried into the original question so that it can be formatted correctly. Third, don't demand "full corrected code". If something didn't work, then we simply need to explore the problem in greater depth. People here aren't trying to trick you, but neither are they here to do your bidding; they're spending their own time to help you out of courtesy. Be polite, learn how to use this site, and don't treat it as a substitute for expending some effort to solve your own problems or for learning on your own.
I'm so sorry if I sounded rude,I didn't mean that:( Sorry to all,but I am anxious cause I have to deliver the project on Monday and I don't have enough time to finish it! I will post below the first code,that generates me an error.Thnx 4 helping me:)
Marin: It's nearly impossible to read code that is posted in comments. Go back and edit your original question at the top of the page to include the new code that you tried and didn't work, so that it can be formatted properly and people can take a look at it.
|
2
if (!isset($GLOBALS['fc_config']['themes'][$name]['name'])) {

take a look at the isset function

1 Comment

can you say me what to do?how to repair it?
1

Try this:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.