demvlg Posted January 24, 2018 Report Share Posted January 24, 2018 как в шаблоне задать условие {{if главная страница}} здесь покажем чтото {{endif}} Quote Link to comment Share on other sites More sharing options...
Respected Posted January 24, 2018 Report Share Posted January 24, 2018 Смотря какое приложение является главной страницей Quote Link to comment Share on other sites More sharing options...
demvlg Posted January 24, 2018 Author Report Share Posted January 24, 2018 Pages Но использовать данный оборот хочу в globalTemplate Quote Link to comment Share on other sites More sharing options...
andros0789 Posted January 24, 2018 Report Share Posted January 24, 2018 Качан не варит уже, но примерно так: <html> <head> </head> <body id='' class='ipsApp header5'> <div class="main-content {{if in_array('header5', \IPS\Output::i()->bodyClasses )}}ipsHide{{endif}}"> {block="Ваш блок"} </div> </body> </html> wasder12 1 Quote Link to comment Share on other sites More sharing options...
demvlg Posted January 25, 2018 Author Report Share Posted January 25, 2018 5 часов назад, andros0789 сказал: header5 а это откуда? Quote Link to comment Share on other sites More sharing options...
wasder12 Posted January 25, 2018 Report Share Posted January 25, 2018 А чё просто в приложениях ни как как раньше? Quote Link to comment Share on other sites More sharing options...
andros0789 Posted January 25, 2018 Report Share Posted January 25, 2018 8 часов назад, demvlg сказал: а это откуда? я вам показал пример вывода и условия. если в боди есть этот класс то оно выведет этот блок Quote Link to comment Share on other sites More sharing options...
andros0789 Posted January 25, 2018 Report Share Posted January 25, 2018 11 минут назад, andros0789 сказал: я вам показал пример вывода и условия. если в боди есть этот класс то оно выведет этот блок Если нет в body этого, то применится к div'у class ipsHide и этот div будет скрыт. А для того чтобы в нужной странице добавить класс header5, Вам нужно прописать на нужной странице другой код (к примеру у меня в шаблоне краткой новости) {{\IPS\Output::i()->bodyClasses[] = 'header5';}} И при входе на страницу с новостями у вас будет добавляться class header5 в body. Quote Link to comment Share on other sites More sharing options...
Nicaea Posted January 26, 2018 Report Share Posted January 26, 2018 Советы выше не особо дельные. Используйте: {{if (\IPS\Request::i()->url()->data['path']) == "/"}} {block="тут ваш блок или что то"}, или текст или html код итд {{endif}} если включен мод реверт то нужно поменять demvlg 1 Quote Link to comment Share on other sites More sharing options...
demvlg Posted January 26, 2018 Author Report Share Posted January 26, 2018 Вот это похожу на верную логику) Сейчас нет возможности проверить, с гет параметрами будет работать? к примеру если урл будет сайт.ру/?from=yandex будет также считаться за главную - или уже условие не сработает? Quote Link to comment Share on other sites More sharing options...
Nicaea Posted January 26, 2018 Report Share Posted January 26, 2018 35 минут назад, demvlg сказал: Вот это похожу на верную логику) Сейчас нет возможности проверить, с гет параметрами будет работать? к примеру если урл будет сайт.ру/?from=yandex будет также считаться за главную - или уже условие не сработает? Все что за / считается другой страничкой и не показывает контент там. За доп информацией пишите в лс. Помогу если нужно) Quote Link to comment Share on other sites More sharing options...
demvlg Posted January 26, 2018 Author Report Share Posted January 26, 2018 {{if (\IPS\Request::i()->url()->data['path'] == '/' and ! \IPS\Request::i()->url()->data['query']) or (! \IPS\Request::i()->url()->data['path'] and \IPS\Request::i()->url()->data['query'])}} код на главной, даже с /?... {{endif}} можно закрывать Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.