TemKa_SD Posted February 23, 2019 Share Posted February 23, 2019 Здравствуйте. Есть вот такой фильтр: // Фильтр по botid if ( isset( \IPS\Request::i()->botId ) ) { $ids = explode( ',', \IPS\Request::i()->botId ); } else if ( isset( \IPS\Request::i()->cookie['runningGames_botIds'] ) ) { $ids = explode( ',', \IPS\Request::i()->cookie['runningGames_botIds'] ); } if ( isset( $ActiveGamesWidgetBots ) AND (!isset( \IPS\Request::i()->botId ) AND !isset( \IPS\Request::i()->cookie['runningGames_botIds'] )) ) { $ids = explode( ',', $ActiveGamesWidgetBots ); } Здесь вроде бы всё правильно, меня интересует следующее: if ( isset( $ActiveGamesWidgetBots ) AND (!isset( \IPS\Request::i()->botId ) AND !isset( \IPS\Request::i()->cookie['runningGames_botIds'] )) ) { $ids = explode( ',', $ActiveGamesWidgetBots ); } $ActiveGamesWidgetBots - переменная отвечает за вывод конфигурации из виджета, скажите на счет всего условия, оно верно? И у меня второй вопрос, изначально условие (!isset( \IPS\Request::i()->botId ) AND !isset( \IPS\Request::i()->cookie['runningGames_botIds'] )) я писал через OR, почему оно через OR не работает, а AND работает, ведь звучит оно так: Если выбран $ActiveGamesWidgetBots и (не выбран \IPS\Request::i()->botId ИЛИ не выбран \IPS\Request::i()->cookie['runningGames_botIds'] ) условие выполняется. Ведь если здесь будет AND - буду прелестниваться они оба вместе, и первое и второе, что я не так понимаю? Link to comment Share on other sites More sharing options...
newbie Posted February 24, 2019 Share Posted February 24, 2019 я писал через OR, почему оно через OR не работает, а AND работает, ведь звучит оно так: Если выбран $ActiveGamesWidgetBots и (не выбран \IPS\Request::i()->botId ИЛИ не выбран \IPS\Request::i()->cookie['runningGames_botIds'] ) условие выполняется. Ведь если здесь будет AND - буду прелестниваться они оба вместе, и первое и второе, что я не так понимаю? При каких условиях не работает? Link to comment Share on other sites More sharing options...
TemKa_SD Posted February 24, 2019 Author Share Posted February 24, 2019 if ( isset( $ActiveGamesWidgetBots ) AND (!isset( \IPS\Request::i()->botId ) OR !isset( \IPS\Request::i()->cookie['runningGames_botIds'] )) ) Link to comment Share on other sites More sharing options...
newbie Posted February 24, 2019 Share Posted February 24, 2019 Это и так понятно. Я имел ввиду$ActiveGamesWidgetBots - ?\IPS\Request::i()->botId - ?\IPS\Request::i()->cookie['runningGames_botIds'] - ? Link to comment Share on other sites More sharing options...
TemKa_SD Posted February 24, 2019 Author Share Posted February 24, 2019 \IPS\Request::i()->botId Link to comment Share on other sites More sharing options...
newbie Posted February 24, 2019 Share Posted February 24, 2019 \IPS\Request::i()->botIdКакие переменные установлены и какие имеют значения, при которых не выполняется условие? Link to comment Share on other sites More sharing options...
TemKa_SD Posted February 24, 2019 Author Share Posted February 24, 2019 Не работает: http://prntscr.com/mpcbxe if ( isset( $ActiveGamesWidgetBots ) AND (!isset( \IPS\Request::i()->botId ) OR !isset( \IPS\Request::i()->cookie['runningGames_botIds'] ) ) ) { $ids = explode( ',', $ActiveGamesWidgetBots ); } Работает: http://prntscr.com/mpccbn if ( isset( $ActiveGamesWidgetBots ) AND (!isset( \IPS\Request::i()->botId ) AND !isset( \IPS\Request::i()->cookie['runningGames_botIds'] ) ) ) { $ids = explode( ',', $ActiveGamesWidgetBots ); } Link to comment Share on other sites More sharing options...
newbie Posted February 24, 2019 Share Posted February 24, 2019 Что я тут должен увидеть, если значения переменных мне не известны, кроме \IPS\Request::i()->botId?К тому же Вы уверены что отрабатывает условие с AND, а не if ( isset( \IPS\Request::i()->botId ) ) { $ids = explode( ',', \IPS\Request::i()->botId ); }? Link to comment Share on other sites More sharing options...
TemKa_SD Posted February 24, 2019 Author Share Posted February 24, 2019 (edited) Код показываем текстом. Edited February 24, 2019 by siv1987 Link to comment Share on other sites More sharing options...
siv1987 Posted February 24, 2019 Share Posted February 24, 2019 @TemKa_SD, неужели нельзя две строчки кода показать текстом а не скриншотом? Сколько можно об этом говорить, изучать код по десяти скришотам а еще когда его нужно процетировать жутко не удобное занятие. Link to comment Share on other sites More sharing options...
TemKa_SD Posted February 24, 2019 Author Share Posted February 24, 2019 (edited) Я показываю код текстом, пожалуйста, текстом что вы удалили: Array ( [games] => Array ( [ActiveGamesWidgetBots] => * [\IPS\Request::i()->botId] => 6 ) [pagination] => ) Edited February 24, 2019 by TemKa_SD Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now