Jump to content
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Из темы узнать ID подфорума

Раньше в тройке размещал рекламу в произвольном месте в зависимости от подфорума.

Сейчас пытаюсь тоже самое разместить в 4.1, но не выходит.

В самом подфоруме в списке тем могу достать ID подфорума, а вот в самой теме этого подофорума - нет.

Вот мой код:

{{if request.app='forums' and request.module ='forums' and request.controller ='forums'}}
 {{if request.id == 91 OR request.id == 114}}{advertisement="MY_ADV_PLACE"}
 {{else}}{advertisement="ad_global_header"}
 {{endif}}
{{endif}}

Вопрос - как в самой теме вытащить ID подфорума?

Featured Replies

Шаблон какой?

Кстати первая строка у Вас не корректна.

{{if request.app='forums' and request.module ='forums' and request.controller ='forums'}}

Должно быть по 2 знака =

  • Author

Шаблон GlobalTemplate

В нем нет нужных данных.

Можно через тему

{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'topic' and request.id}}
{{ $fid = null; try { $topic = \IPS\forums\Topic::loadAndCheckPerms(request.id); $fid = $topic->container()->_id; } catch(\Exception $e){} }}
{{if in_array($fid, array(91, 114))}}
	{advertisement="MY_ADV_PLACE"}
{{else}}
	{advertisement="ad_global_header"}
{{endif}}
{{endif}}

  • Author

Это для какого шаблона? В GlobalTemplate не работает данный код

Это для какого шаблона?

Для какого просили.

В GlobalTemplate не работает данный код

Что выводится? И выводится ли вообще? Объявления созданы? В теме смотрите результат?

Попробуйте с числами

{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'topic' and request.id}}
   {{ $fid = null; try { $topic = \IPS\forums\Topic::loadAndCheckPerms(request.id); $fid = $topic->container()->_id; } catch(\Exception $e){} }}
   {{if in_array($fid, array(91, 114))}}
       123
   {{else}}
       321
   {{endif}}
{{endif}}

  • Author

Сори тупанул. Все разобрался.

В общем вот мой конечный код, чтобы и в разделах и в темах показывался баннер:

{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'topic' and request.id}}
   {{ $fid = null; try { $topic = \IPS\forums\Topic::loadAndCheckPerms(request.id); $fid = $topic->container()->_id; } catch(\Exception $e){} }}
   {{if in_array($fid, array(91, 114))}}
       {advertisement="MY_ADV_PLACE"}
   {{else}}
       {advertisement="ad_global_header"}
   {{endif}}
{{elseif request.app=='forums' and request.module == 'forums' and request.controller == 'forums'}}
 {{if request.id == 91 OR request.id == 114}}{advertisement="MY_ADV_PLACE"}
 {{else}}{advertisement="ad_global_header"}
 {{endif}}      
{{else}}{advertisement="ad_global_header"}                      
{{endif}}

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.