Reputation: 63
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
Upvotes: 2
Views: 1218
Reputation: 60498
Try this:
if (!empty($name) && isset($GLOBALS['fc_config']['themes'][$name]['name'])) {
unset($GLOBALS['fc_config']['themes'][$name]);
}
Upvotes: 1
Reputation: 19118
if (!isset($GLOBALS['fc_config']['themes'][$name]['name'])) {
take a look at the isset
function
Upvotes: 2
Reputation: 345
try using isset( $GLOBALS['fc_config']['themes'][$name]['name'] ) with the not
Upvotes: 2