2

I suspect one of you brilliant folks in the EE community will be abel to help me. I need to add a disclaimer-style checkpoint prior to entering a given template group within an EE site. Specifically, it's a medical site with a before and after gallery and some photos in the gallery could be perceived as graphic in nature - and so I want a "visitor beware" kind of selection screen before the user gets into that section. So I'm looking for a way to have the following happen:

1) Upon accessing a give template group path (domain.com/example) a modal window opens with a brief disclaimer allowing the user to choose yes or no to proceed.

2) If yes, the user continues to the template group, if no, they continue to a URL path I designate (probably a placeholder, wherein they would continue to browse the rest of the site and I also give them the ability to reverse their previous no to a yes)

3) the selection that they make in the modal is persistent for, let's say, a browser session. They are still forced to make that same choice the next time they visit the site, even if on the same day, within the browser session.

4) In being a persistent value, the next time they browser to domain.com/example, the rule dictated by their previous selection or yes versus no is enforced. If they clicked yes, they simply access domain.com/example unfettered. If they clicked no, they are routed to the "alternative" landing page wherein they are presented the opportunity to change their mind and select yes.

So I'm guessing this is a javascript thing. I've done something like it, but not in a way that affected routing. It was merely a language selection that then determined whether they were accessing the site via the english or french URL. I've not tried something like there where the selection they make has some influence over what they see within a given template group. I suspect i could repurpose the javascript that was used to perform the language selection, but the behaviour after that was linked to different URLs in the site (domain.com/en/ and domain.com/fr/) whereas in this case, it's all one URL.

Anyone done this before? Advice on how to approach this?

3

If it were me, I wouldn't use JS to handle this, as anyone with JS disabled will be able to get around this stuff. Even using browser cookies could be circumvented, so you really need to think how important is it to see these screens. If having JS and cookies disabled isn't a factor, go with whatever method you this is faster (most likely a jquery solution).

How I would do it would be to customize this add-on.

http://devot-ee.com/add-ons/cookie-plus

Or use this awesome add-on

http://devot-ee.com/add-ons/mo-variables

Really just try to find the best base to start from with the least amount of work to add the desired functionality.

Basically, add a parameter to the setters/getters to handle the redirects. This plugin will do all the cookie work for you, you will just have to manage the redirects.

Using the {redirect="your/path"} probably won't work since you will be redirected before the cookie plugin tag is parsed - which is why I would add the redirects to the setters/getters yourself (or have another PHP developer do it).

Really this should be very simple and quick updates if you use that existing module. In my mind, harnessing a pre-built add-on to add the additional functionality would be best - provided there isn't something already in existence. (I have not seen such add-on, so I am not sure if it exists which I why I outline this DIY solution.)

0

I've always thought that the In Focus photoblog handles this quite well, placing a 'graphic content' overlay on top of flagged images (example). I don't think their approach implements sessions but it would be fairly trivial to set a show_flagged_images cookie with jQuery. Removing any other overlays on the page at the same time would also be simple.

This is a slightly different approach to what you're suggesting, but it would be lightweight, easy to implement and is fairly user friendly, as you're not bouncing people from one page to another - overlays can be removed instantly.

Whether or not requiring JS is an issue will depend on your audience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.