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

Tyler McHenry
77k18 gold badges126 silver badges171 bronze badges
asked May 18, 2010 at 20:15
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

answered May 18, 2010 at 20:20
10
  • @Marin: isset works differently for you than everyone else? Prove it. Post the new code. Commented May 18, 2010 at 20:29
  • <?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'] ) } } } ?> Commented May 18, 2010 at 20:34
  • 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. Commented May 18, 2010 at 20:43
  • 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:) Commented May 18, 2010 at 20:46
  • 1
    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. Commented May 18, 2010 at 20:49
2
if (!isset($GLOBALS['fc_config']['themes'][$name]['name'])) {

take a look at the isset function

answered May 18, 2010 at 20:22
1
  • can you say me what to do?how to repair it? Commented May 18, 2010 at 20:40
1

Try this:

 if (!empty($name) && isset($GLOBALS['fc_config']['themes'][$name]['name'])) {
 unset($GLOBALS['fc_config']['themes'][$name]);
 }
answered May 18, 2010 at 20:22
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.