Is it possible to pick multiple templates by 'intendedTemplate'?

Hi all

I’m trying to not load a java library on 2 pages. So this is the code I have but it’s not working.

    <?php if ($page->intendedTemplate()->name() != ('home' || 'magazin')): ?>
        <?= js('assets/js/radio.js') ?>
    <?php endif ?>

If I only have != home then it does work. Is it possible to say if the page template doesn’t equal this or this…

You can use in_array for that:

<?php if (in_array($page->intendedTemplate()->name(), ['home', 'magazin']) === false): ?>
    <?= js('assets/js/radio.js') ?>
<?php endif ?>
1 Like

That worked! Thank you!