Statamic Mobile Detect Plugin
This plugin could not exist without the amazing work of the Mobile Detect project
Installing via git
Clone the repo via git into
/_add-ons/.cd _add-ons/ git clone git@github.com:haikulab/statamic-mobile-detect.git mobile_detectPull in the
Mobile Detectrepository usinggit submodulescd mobile_detect/ git submodule init git submodule update
You should see something like this:
→ git submodule init
Submodule 'Mobile-Detect' (git://github.com/serbanghita/Mobile-Detect.git) registered for path 'Mobile-Detect'
→ git submodule update
Cloning into 'Mobile-Detect'...
remote: Reusing existing pack: 1712, done.
remote: Total 1712 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1712/1712), 1.94 MiB | 596.00 KiB/s, done.
Resolving deltas: 100% (825/825), done.
Submodule path 'Mobile-Detect': checked out 'd6943b36f45a9ee654e87cd98832890797a228fb'
Ensure the plugin-in folder name is
mobile_detect(and not statamic-mobile-detect).mv statamic-mobile-detect mobile_detectClear the Statamic cache - How to clear the cache
- Use the tags listed in Usage.
Usage
Core Tag
{{ mobile_detect }}
Example Output for {{ mobile_detect }}
computertabletphone
Get Mobile Detect library version number
{{ mobile_detect:library_version }}
Example Output for {{ mobile_detect:library_version }}
2.8.17
Using as part of logic
Using {{ mobile_detect }} as part of an {{ if }} statement:
{{if something == { mobile_detect } }}
...
{# some content #}
...
{{ endif }}
Tested on
Disclaimer
I've 'written' this plugin for my own use. It comes without any guarantee, so your mileage may vary in using it. If you find bugs or have great additions you'd like to share, use github to fork the project and share your improvements by initiating pull request
MIT License
Copyright (c) 2014 Sergei Filippov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



