Permalink
Browse files

Better check for empty fields in the layout generator

  • Loading branch information...
1 parent 3e238c2 commit 025b82584c05c220932ce6e789d05079dcc3b7dc @leofeyer leofeyer committed May 30, 2012
Showing with 17 additions and 14 deletions.
  1. +1 −1 assets/css/default.css
  2. +10 −6 system/modules/core/pages/PageRegular.php
  3. +6 −7 templates/music_academy.sql
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -214,16 +214,20 @@ protected function createTemplate($objPage, $objLayout)
if ($objLayout->static)
{
$arrSize = deserialize($objLayout->width);
- $arrMargin = array('left'=>'0 auto 0 0', 'center'=>'0 auto', 'right'=>'0 0 0 auto');
- $strFramework .= sprintf('#wrapper{width:%s;margin:%s}', $arrSize['value'] . $arrSize['unit'], $arrMargin[$objLayout->align]);
+
+ if (isset($arrSize['value']) && $arrSize['value'] != '' && $arrSize['value'] >= 0)
+ {
+ $arrMargin = array('left'=>'0 auto 0 0', 'center'=>'0 auto', 'right'=>'0 0 0 auto');
+ $strFramework .= sprintf('#wrapper{width:%s;margin:%s}', $arrSize['value'] . $arrSize['unit'], $arrMargin[$objLayout->align]);
+ }
}
// Header
if ($objLayout->rows == '2rwh' || $objLayout->rows == '3rw')
{
$arrSize = deserialize($objLayout->headerHeight);
- if (isset($arrSize['value']) && $arrSize['value'] >= 0)
+ if (isset($arrSize['value']) && $arrSize['value'] != '' && $arrSize['value'] >= 0)
{
$strFramework .= sprintf('#header{height:%s}', $arrSize['value'] . $arrSize['unit']);
}
@@ -236,7 +240,7 @@ protected function createTemplate($objPage, $objLayout)
{
$arrSize = deserialize($objLayout->widthLeft);
- if (isset($arrSize['value']) && $arrSize['value'] >= 0)
+ if (isset($arrSize['value']) && $arrSize['value'] != '' && $arrSize['value'] >= 0)
{
$strFramework .= sprintf('#left{width:%s;right:%s}', $arrSize['value'] . $arrSize['unit'], $arrSize['value'] . $arrSize['unit']);
$strContainer .= sprintf('padding-left:%s;', $arrSize['value'] . $arrSize['unit']);
@@ -248,7 +252,7 @@ protected function createTemplate($objPage, $objLayout)
{
$arrSize = deserialize($objLayout->widthRight);
- if (isset($arrSize['value']) && $arrSize['value'] >= 0)
+ if (isset($arrSize['value']) && $arrSize['value'] != '' && $arrSize['value'] >= 0)
{
$strFramework .= sprintf('#right{width:%s}', $arrSize['value'] . $arrSize['unit']);
$strContainer .= sprintf('padding-right:%s;', $arrSize['value'] . $arrSize['unit']);
@@ -266,7 +270,7 @@ protected function createTemplate($objPage, $objLayout)
{
$arrSize = deserialize($objLayout->footerHeight);
- if (isset($arrSize['value']) && $arrSize['value'] >= 0)
+ if (isset($arrSize['value']) && $arrSize['value'] != '' && $arrSize['value'] >= 0)
{
$strFramework .= sprintf('#footer{height:%s}', $arrSize['value'] . $arrSize['unit']);
}
Oops, something went wrong.

0 comments on commit 025b825

Please sign in to comment.