Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
EDC:
Download extensions for Elxis CMS
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Differentiate between phones and tablets
« previous
next »
Print
Pages: [
1
]
Author
Topic: Differentiate between phones and tablets (Read 6548 times)
jesusto
Jr. Member
Posts: 68
Differentiate between phones and tablets
«
on:
December 18, 2013, 04:02:59 »
Hi all,
I would like that mobile template is used only when a phone is detected and continue using the desktop template for tablets.
Does anyone know how to achieve this?
Thanks in advance
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Differentiate between phones and tablets
«
Reply #1 on:
December 18, 2013, 09:33:50 »
Bad idea. The distinguise between a tablet/mobile device and a desktop one is not only a matter of screen size. If you have a mini laptop with 12 inch monitor and a tablet with 11 inch, the screen might look the same but they are totally different devices mostly because they are handled differently. On one side you have a touch screen and on the the other a standard monitor with a keyboard. These 2 devices should be handled differently else you will have browsing issues. So I strongly recommend you not to do this.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
jesusto
Jr. Member
Posts: 68
Re: Differentiate between phones and tablets
«
Reply #2 on:
December 18, 2013, 11:42:56 »
I understand.
What about apliying a different css for tablets then, how can I do that?
I like mobile template very much for phones but I would like something different for the ipad, for example.
Thanks
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Differentiate between phones and tablets
«
Reply #3 on:
December 18, 2013, 19:33:14 »
You detect devices via css media rule. You can't detect the exact device, only via its width/height parameters. For iPad this will do the work:
@media only screen and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
.mpla { color:red; }
}
@media only screen and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape) {
.mpla { color:green; }
}
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: Differentiate between phones and tablets
«
Reply #4 on:
August 27, 2014, 15:24:11 »
Hi there,
I have the same question but not understanding completely - how do we stop the mobile version coming into effect for tablets?
I understand the pitfalls, but the mobile version is not suitable at all for tablets in this particular instance.
thanks!
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Differentiate between phones and tablets
«
Reply #5 on:
August 27, 2014, 19:55:19 »
You have 2 options:
1.
Enable mobile device detection and use a special template (mobile.php) for mobile phones, tablets, ipods, etc. In this case Elxis also generates different HTML output. To exclude tablets from this option you have to modify the detection function.
Helper:
browser
(class
elxisBrowserHelper
)
Method:
isMobile
File:
includes/libraries/elxis/helpers/browser.helper.php
Method sample usage:
$elxis->obj('browser')->isMobile();
//returns true/false
2.
Disable mobile device detection and handle layout and styling via CSS media rules. Elxis 4.2 and template
Flex
does exactly this.
My advice is to keep tablets treated like mobile phones. There are both touch devices with limited functionality and there are 7 and 8 inches tablets which are not much bigger than smart phones. So these devices should be handled the same. With media rules you can do many tricks the way I show you on my previous message.
«
Last Edit: August 27, 2014, 20:00:36 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: Differentiate between phones and tablets
«
Reply #6 on:
August 28, 2014, 15:23:51 »
Great, thanks!
Logged
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Differentiate between phones and tablets