Detect if moblie layout was selected in K2 item override
- GK User
- Wed Jul 15, 2015 7:27 pm
Hi, I'm still working with this template and now I need to know if the current template layout is a mobile one from the template K2 item.php override located at gk_black_and_white/html/com_k2/templates/default/item.php
Is that possible?
Thanks!
Is that possible?
Thanks!
-
- Expert Boarder
- GK User
- Wed Jul 15, 2015 7:52 pm
Forget it, just put this code in the item.php file and worked...
- Code: Select all
if(!class_exists('GKBrowser')) {
require_once(dirname(__FILE__).'/../../../../lib/framework/gk.browser.php');
}
$gkbrowser = new GKBrowser();
$browser = $gkbrowser->detectBrowser();
if($browser->get('mobile')) {
$mapWidth = 374;
$mapHeight = 208;
} else {
$mapWidth = 630;
$mapHeight = 350;
}
-
- Expert Boarder
- teitbite
- Sat Jul 18, 2015 9:55 am
Hi
Yes, that's the only way. Very good solution, thank You for shearing it with us. Thread closed.
Yes, that's the only way. Very good solution, thank You for shearing it with us. Thread closed.
-
- Moderator
3 posts
• Page 1 of 1