New answers tagged

1

Here's how I approach what I think you're trying to do. I have a global Notice setup, which includes a lightswitch field called showNotice, a heading called noticeTitle and a text field called noticeText. Note I only check for the existence of the cookie. I'm not interested in the value, which is what you seem to be doing here: {% if checkCookieHeader != ...


3

I would think that you could hook into one of the template render events like: craft\web\View::EVENT_BEFORE_RENDER craft\web\View::EVENT_BEFORE_RENDER_TEMPLATE craft\web\View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE Alternatively, you might want to check out the source code for the KnockKnock plugin, which intercepts page loads to present a custom password ...


Top 50 recent answers are included