From b55c2776a56724d7d57ce66cc0b9410414687063 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 22 Jun 2006 21:41:41 +0000 Subject: [PATCH] Compact the top 'X' lists on the main page by adding a flag to get_screenshot_img() that disables the output of html that was putting the image inside of another table --- include/screenshot.php | 22 +++++++++++++++++----- include/util.php | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/screenshot.php b/include/screenshot.php index d076919..9322078 100644 --- a/include/screenshot.php +++ b/include/screenshot.php @@ -303,8 +303,10 @@ class Screenshot { /** * Get a random image for a particular version of an app. * If the version is not set, get a random app image + * + * $bFormatting == false turns off all extranious formatting applied to the returned image html */ -function get_screenshot_img($iAppId = null, $iVersionId = null) +function get_screenshot_img($iAppId = null, $iVersionId = null, $bFormatting = true) { // we want a random screenshots for this app if($iAppId && !$iVersionId) @@ -325,16 +327,24 @@ function get_screenshot_img($iAppId = null, $iVersionId = null) AND queued = 'false' ORDER BY rand"); } + + if($bFormatting) + $sImgFile .= '
'; + if(!$hResult || !mysql_num_rows($hResult)) { - $sImgFile = '
No Screenshot
'; + $sImgFile = 'No Screenshot'; } else { $oRow = mysql_fetch_object($hResult); - $sImgFile = '
'.$oRow->description.'
'; + $sImgFile = ''.$oRow->description.''; } + + if($bFormatting) + $sImgFile .= '
'; - $sImg = html_frame_start("",'128','',2); + if($bFormatting) + $sImg = html_frame_start("",'128','',2); /* we have screenshots */ if(mysql_num_rows($hResult)) @@ -350,7 +360,9 @@ function get_screenshot_img($iAppId = null, $iVersionId = null) { $sImg .= $sImgFile; } - $sImg .= html_frame_end()."
"; + + if($bFormatting) + $sImg .= html_frame_end()."
"; return $sImg; } diff --git a/include/util.php b/include/util.php index 5b01733..8c6e5ec 100644 --- a/include/util.php +++ b/include/util.php @@ -266,12 +266,12 @@ function outputTopXRow($oRow) { $oVersion = new Version($oRow->versionId); $oApp = new Application($oVersion->iAppId); - $img = get_screenshot_img(null, $oRow->versionId); // image + $img = get_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting echo ' '.$oApp->sName.' '.$oVersion->sName.' '.trim_description($oApp->sDescription).' - '.$img.' +
'.$img.'
'; }