mmikkel / Detect-Craft

Craft CMS wrapper for the Mobile_Detect library
MIT License
26 stars 3 forks source link

android detection #1

Closed kaspar-allenbach closed 8 years ago

kaspar-allenbach commented 8 years ago

Hi.

This works:

{% if isUserMobile %}
  {# blabla #}
{% endif %}

but this doesn't:

{% if isAndroidOS %}
  {# blabla #}
{% endif %}

This returns:

Variable "isAndroidOS" does not exist

Why?

mmikkel commented 8 years ago

That error is unrelated to Detect; it simply means that you haven't actually set the isAndroidOS variable you're testing.

You'll either need to do this:

{% if craft.detect.isAndroidOS %}
    {# blabla #}
{% endif %}

...or this:

{% set isAndroidOS = craft.detect.isAndroidOS %}
{% if isAndroidOS %}
    {# blabla #}
{% endif %}