Jump to content

Featured Replies

Posted

Hello. I am trying to display a meta tag based on the forum id. But this code placed in the global template does not work. 

Could someone help me to understand what is wrong with the template code.

Thank you.

{{if request.app == 'forums' && request.module == 'forums' && in_array(request.id, array(24, 31, 46) )}}
<meta name="ezoicnoads" content="members">
{{endif}}


 

  • Author

I would really appreciate if someone knows why the above template code is not working.

Try 

{{if \IPS\Dispatcher::i()->application->directory == 'forums' and \IPS\Dispatcher::i()->module and \IPS\Dispatcher::i()->module->key == 'forums' AND \IPS\Dispatcher::i()->controller == 'forums' AND \in_array(\IPS\Request::i()->id, [24, 31, 46] )}}
will be only shown on the forum page for forum 24, 31, 46
{{endif}}

 

BUT this is ONLY for the forum view and not topics!

You'll need another condition for the topic controller which takes the topic to get the forum id for the in_array check if you want need this also inside topics.

  • Author

Thank you Daniel. Yes, i need a conditional that would work both for forums and topics. Could you help me modify it accordingly if possible? 

  • Author

@Daniel F, anyone? How do I fix this conditional? 

Recently Browsing 0

  • No registered users viewing this page.