Index: typo3/sysext/cms/layout/class.tx_cms_layout.php =================================================================== --- typo3/sysext/cms/layout/class.tx_cms_layout.php (revision 9958) +++ typo3/sysext/cms/layout/class.tx_cms_layout.php (revision ) @@ -394,24 +394,31 @@ /** * Returns the backend layout which should be used for this page. * - * @param integer $id: Uid of the current + * @param integer $id: Uid of the current page * @return integer The Uid of the backend layout record */ function getSelectedBackendLayoutUid($id) { - $rootline = t3lib_BEfunc::BEgetRootLine($id); + $page = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('be_layout', 'pages', 'uid=' . $id); + $backendLayoutUid = intval($page['be_layout']); + if ($backendLayoutUid == -1) { + // if it is set to "none" - don't use any! - $backendLayoutUid = null; + $backendLayoutUid = null; - for ($i = count($rootline); $i > 0; $i--) { - $page = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, be_layout, be_layout_next_level', 'pages', 'uid=' . intval($rootline[$i]['uid'])); - if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id) { - $backendLayoutUid = intval($page['be_layout_next_level']); + } else if (!$backendLayoutUid) { + // check the rootline for a layout on next level and use this! + $rootline = t3lib_BEfunc::BEgetRootLine($id); + for ($i = count($rootline)-2; $i > 0; $i--) { + $backendLayoutUid = intval($rootline[$i]['be_layout_next_level']); + if ($backendLayoutUid > 0) { - break; - } else { + break; + } else { - if (intval($page['be_layout']) > 0) { - $backendLayoutUid = intval($page['be_layout']); + // if it is set to "none" - don't use any and stop searching! + if ($backendLayoutUid == -1) { + $backendLayoutUid = null; - break; - } - } - } + break; + } + } + } + } return $backendLayoutUid; } Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 9873) +++ t3lib/class.t3lib_befunc.php (revision ) @@ -605,7 +605,7 @@ 't3ver_state' => $val['t3ver_state'], 't3ver_swapmode' => $val['t3ver_swapmode'], 't3ver_stage' => $val['t3ver_stage'], - 'be_layout' => $val['be_layout'] + 'be_layout_next_level' => $val['be_layout_next_level'] ); if (isset($val['_ORIG_pid'])) { $output[$c]['_ORIG_pid'] = $val['_ORIG_pid']; @@ -633,7 +633,7 @@ $row = $getPageForRootline_cache[$ident]; } else { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage,be_layout', + 'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage,be_layout_next_level', 'pages', 'uid=' . intval($uid) . ' ' . self::deleteClause('pages') . ' ' .