Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
Device detection
Device detection
Hi
I would like to use your class device detection in order to switch some specific content that I have for mobile devices.
instead of using only
Code:
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPad'))
I would prefer to have all mobile devices by including your class
Could you help me on this and tell me what I would have to include and what condition I should add ?
Re: Device detection
Are you saying that you have MetaTemplate Pro, and would like to utilise the device detection that's built-in to that, but in another component or module or template somewhere (i.e. not from inside MetaTemplate Pro)?
hmmm... well I don't want to advise trying to "include" any of my class files from anywhere else, because they are liable to change in future versions.
However I think the easiest way to do this would be:
1 - set up a new rule, as the 1st rule in the MetaTemplate Pro rule chain (re-order them if necessary)
2 - set the rule up to detect all mobile devices
3 - in the SUCCEED action, in the PHP box, put: define ("MOBILE_DEVICE_FOUND", 1);
4 - also in the SUCCEED action, select "process next rule in chain", if you have any other rules that need to be run. The purpose of this particular rule is only to set the MOBILE_DEVICE_FOUND constant.
5 - in any other part of Joomla you can use: if ( defined("MOBILE_DEVICE_FOUND") ) { ... whatever ... }
So what you have done is used MetaTemplate Pro to detect certain conditions, then created a sort of flag that can be used in other parts of Joomla.
Hope that helps,
Stephen
Re: Device detection
Hi,
I'm working hard on it, but I'm also on a work trip for 2 weeks so I won't be able to release it before I get back.
Hmmm, might be better to release an interim version with this addition and a couple of other minor changes... thanks for your patience, there are just so many new things to add that I'm going to have to draw the line in order to release something...
Cheers,
Stephen
Re: Device detection
Hi alterna,
check out MetaTemplate and MetaTemplate Pro v1.5, which have iPad support (as well as lots of other new browsers and bot support).
MTP is downloadable from your Account page (assuming you already purchased). The upgrade is free as always.
Cheers,
Stephen
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7628
- Newest User:
- horlogekorting34
- Members Online:
- 1
- Guests Online:
- 130
- Online:
- uistr4qx
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked