[geeklog-devel] Mobile Detect in Geeklog

Tom websitemaster at cogeco.net
Mon May 30 16:09:40 EDT 2016


I am thinking of  adding mobile detect to Geeklog

https://github.com/Geeklog-Core/geeklog/issues/683

by using this class

http://mobiledetect.net/

This way in code we can determine if the visitor is using a phone, tablet or
computer to access the website. The class uses the user-agent string and
http headers to detect this. Obviously these things can be spoofed so no
mobile detection script will be 100% fool proof. I plan on using a simple
wrapper so Geeklog itself will access the class to determine what type of
device it is (in the beginning of lib-common) and store it in the $_CONF
variable so plugins etc.. will be able to access it. This way if in the
future we use a different mobile detect class we don't have to update a
bunch of code.

I also plan on adding the ability for blocks to display base on the fact of
what type of device is being used to view the site. 

I also plan on adding a new block autotag which will allow us to display
blocks in articles and staticpages. This means the "Side" attribute for
blocks will have a new setting "NA" just in case someone wants to display a
block by using an autotag. 

I also would have to update the cache to support this detection since items
on a page will possibly have 3 ways to be viewed.

If anyone has a better mobile class they would like to recommend please let
me know.

Tom




More information about the geeklog-devel mailing list