This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Mercator
Mercator

I would like to include HTML/Java Script code on a static page but only once every 24 hours (a popup window that points to an event). What would be the best way of doing that with Rainlab's Static Papges?

mjauvin
mjauvin

I would create a component to do this, and register the component as a Snippet (see Static Page docs section Snippets created from components here: https://octobercms.com/plugin/rainlab-pages#documentation) So that you can programatically show your content whenever you choose to.

mjauvin
mjauvin

The component could inject a Javascript file that would show the Popup when the page loads. Use the addJs() call in your Component's onRun() method for this.

ref. https://octobercms.com/docs/plugin/components#component-assets

Last updated

Mercator
Mercator

Thanks, Marc. Basically went with your first option and registered the following onStart to the layout's code segment: 'cookieSet' => function ($k, $v, $m) {

        Cookie::queue($k, $v, $m);
        return Cookie::get($k);

    },

    'cookieGet' => function ($k) {

        return Cookie::get($k);

    },

I then can use it directly on the page. Thanks for your support.

Last updated

mjauvin
mjauvin

What do you mean by: "use it directly on the page" ?

Show your code so others can benefit! :)

az-vm
az-vm

Hello,

It is possible to show specific content only on a custom date ?

Show some content by days ?

Kind RegardĀ“s

mjauvin
mjauvin

az-vm said:

Hello,

It is possible to show specific content only on a custom date ?

Show some content by days ?

Kind RegardĀ“s

Please don't hijack an existing thread, create a new forum post.

klas.wirholm
klas.wirholm

There is this plugin, witch is quite good. You can choose with page popup will show up on, static pages also. Its show popup only ones for the visitor. A quick and dirty solution is to create a new popup campaign for every date. At lest a temporary solution, until you get your own code in place.

Plugin:

https://octobercms.com/plugin/indikator-popup

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.