Hello,
I spent a lot of time trying to realize how the layout recognizion mechanism is working
(Actually, the most important question was why $_SESSION['layoutType'] varable is always set to 'legacy')
So...
The file 'zca_responsive_functions.php' contains the following code:
Code:
function layoutTypes()
{
return array('default', 'mobile', 'tablet', 'full');
}
function initLayoutType()
{
// Safety check.
if (!class_exists('Mobile_Detect')) { return 'default'; }
$detect = new Mobile_Detect;
$isMobile = $detect->isMobile();
$isTablet = $detect->isTablet();
$layoutTypes = layoutTypes();
if ( isset($_GET['layoutType']) ) {
$layoutType = $_GET['layoutType'];
} else {
if (empty($_SESSION['layoutType'])) {
$layoutType = ($isMobile ? ($isTablet ? 'tablet' : 'mobile') : 'default');
} else {
$layoutType = $_SESSION['layoutType'];
}
}
if ( !in_array($layoutType, $layoutTypes) ) {
$layoutType = 'default';
}
$_SESSION['layoutType'] = $layoutType;
return $layoutType;
}
$layoutType = initLayoutType();
But this code is executed at the moment, when session is not started yet ($_SESSION array is still undefined)
(containing all functions files is being loaded before 'init_sessions.php' - see
Breakpoint 60 and
Breakpoint 70 in 'config.core.php' file)
Thus, any manipulations with $_SESSION in above mentioned code seem not only as exotical way, but fully incorrect.
It seems strange to me, I am the first who noticed this, but brief search over this forum gave no relevalt results.
Sorry, if I do understand something wrong
Bookmarks