Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
tolik777

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

Recommended Posts

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

Сейчас пытаюсь тоже самое разместить в 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 подфорума?

Share this post


Link to post

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

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

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

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

Share this post


Link to post

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

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

{{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}}

Share this post


Link to post

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

Share this post


Link to post

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

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

В 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}}

Share this post


Link to post

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

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

{{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}}

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...