Conditional Content

Nested conditions

7 months 3 weeks ago #75026

Simon Logan's Avatar Simon Logan

Is it possible to nest or combine conditions? I tried this but it didn't seem to work as expected:

{show ip="137.195, 94.200.75.149, 217.33.165.201, 195.166.151.92"}

{show browser="Chrome"}

This message should be displayed to users in the IP range who are using Chrome.

{show-else}

This would be shown to users in the IP range who AREN'T using Chrome.

{/show}

{show-else}

And this would be shown to users who aren't in the IP range, regardless of browser.

{/show}

7 months 3 weeks ago #75027

Peter van Westen's Avatar Peter van Westen Admin

No, you cannot nest them. But you can simply create 3 show tags with the conditions you need.

7 months 3 weeks ago #75030

Simon Logan's Avatar Simon Logan

So can I combine conditions within a single conditional area?

I need to check if the user is within the IP range AND using Chrome for one of them.

7 months 3 weeks ago #75031

Peter van Westen's Avatar Peter van Westen Admin

Yep, simply do:

{show ip="137.195, 94.200.75.149, 217.33.165.201, 195.166.151.92" browser="Chrome"}

This message should be displayed to users in the IP range who are using Chrome.

{/show}{show ip="137.195, 94.200.75.149, 217.33.165.201, 195.166.151.92" browser!="Chrome"}

This would be shown to users in the IP range who AREN'T using Chrome.

{/show}{show ip!="137.195, 94.200.75.149, 217.33.165.201, 195.166.151.92"}

And this would be shown to users who aren't in the IP range, regardless of browser.

{/show}

7 months 3 weeks ago #75032

Peter van Westen's Avatar Peter van Westen Admin

PS: You can use the editor button to generate the correct syntax for 'Exclude' conditions and combinations.

7 months 3 weeks ago #75060

Simon Logan's Avatar Simon Logan

Thanks Peter, have put this in place now and at least the bits I can see are working (since it's got IP restriction on an iframe being loaded for one of those conditions I can't fully test it however I'm pretty confident this is what we need now).

Thanks also for the guidance about the editor button, had missed that one so that should make things easier. Thanks for another great extension, I can see this one of much use in many different cases.

7 months 3 weeks ago #75065

Peter van Westen's Avatar Peter van Westen Admin

Good to hear you have it working :)

You can of course temporarily add your own IP address to the conditions to test that part.

7 months 3 weeks ago #75083

Simon Logan's Avatar Simon Logan

Thanks Peter and yeah I'd already had my own IP in there to test, the issue was that the content being loaded in one of the conditions was an iframe loading content which in itself checks the same IPs, so even though I can get the iframe to show up when the conditions *I* set are matched, I'm still denied access to the content within the iframe by the external site - which is expected, just makes it trickier for me to debug!

The reason for using your extension was just to try and make the display of this content slicker by only showing it if it could show up, as it were, and otherwise display a helpful message. We needed the extra condition for Chrome because it, for some reason, is blocking the iframe content even when the IPs are okay, whereas other browsers display it just fine. Could be mixed content or something else but since I'm not within the right IP range I can't properly debug.

This should be good enough for them, however.

7 months 3 weeks ago #75085

Peter van Westen's Avatar Peter van Westen Admin

Ok, great :)