Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

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 ?

alterna
Beginner Modder
ranks
useravatar
Offline
18 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Device detection

Wonderful, working very well and solved lots of problems for me !!! :-)

By the way, could you add an ipad browser detection in the metatemplate list for other adaptations ?

alterna
Beginner Modder
ranks
useravatar
Offline
18 Posts
Administrator has disabled public posting

Re: Device detection

Yes, it will be in the next release :-)

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Device detection

Stephen,

Could you tell me when is the next release ?
For now, the iPad is recognized as a mobile device and the mobile template is automatically chosen, which is not the behavior that I want

alterna
Beginner Modder
ranks
useravatar
Offline
18 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Device detection

Update: v1.5 had some bugs in it. I suggest you upgrade to 1.5c, released today.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Device detection

Thanks Stephen,

I have just installed it and the first tests seem ok so far !

Cheers
JC

alterna
Beginner Modder
ranks
useravatar
Offline
18 Posts
Administrator has disabled public posting

Re: Device detection

Wonderful - thanks for reporting back.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1691
Total Polls:
6
Total Posts:
5912
Total Posts Today:
6
User Info:
 
Total Users:
11529
Newest User:
jame380003
Members Online:
1
Guests Online:
175

Online: 
jame380003

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked