Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 13, 20222 yr 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}}
September 15, 20222 yr Author I would really appreciate if someone knows why the above template code is not working.
September 15, 20222 yr 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.
September 15, 20222 yr 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?