コード例 #1
0
 //$sql.= " LIMIT {$mediaStartRecord},{$mediaPerPage}";
 //}
 $media = new mediaList($sql);
 // Create a new mediaList object
 if ($returnRows = $media->getRows()) {
     if ($returnRows > $mediaPerPage * $config['searchResultLimit']) {
         $returnRows = $mediaPerPage * $config['searchResultLimit'];
     }
     // Limit the results to X pages
     $mediaPages->setTotalResults($returnRows);
     // Pass the total number of results to the $pages object
     $media->getMediaDetails();
     // Run the getMediaDetails function to grab all the media file details
     $mediaArray = $media->getMediaArray();
     // Get the array of media
     $thumbMediaDetailsArray = $media->getDetailsFields('thumb');
     // Get thumb details
     $smarty->assign('thumbMediaDetails', $thumbMediaDetailsArray);
     $smarty->assign('mediaRows', $returnRows);
     $smarty->assign('mediaArray', $mediaArray);
 }
 /*
  * Get paging info and pass it to smarty
  */
 //$mediaPages->setTotalResults($returnRows); // Pass the total number of results to the $pages object
 $mediaPagingArray = $mediaPages->getPagingArray();
 $mediaPagingArray['pageNumbers'] = range(0, $mediaPagingArray['totalPages']);
 unset($mediaPagingArray['pageNumbers'][0]);
 // Remove the 0 element from the beginning of the array
 $smarty->assign('mediaPaging', $mediaPagingArray);
 $smarty->assign('resultsArray', $_SESSION['searchForm']['resultsArray']);
コード例 #2
0
ファイル: index.php プロジェクト: spencerlambert/willie-php
        	LIMIT {$config[settings][popular_media_count]}
        	";
        */
        $sql = "\r\n\t\t\t\tSELECT SQL_CALC_FOUND_ROWS *\r\n\t\t\t\tFROM {$dbinfo[pre]}media \r\n\t\t\t\tWHERE {$dbinfo[pre]}media.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}media.approval_status = 1 \t\t\t\t\r\n\t\t\t\tAND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB})) \t\t\t\t\r\n\t\t\t\tORDER BY {$dbinfo[pre]}media.views DESC\r\n\t\t\t\tLIMIT {$config[settings][popular_media_count]}\r\n\t\t\t";
        // New 4.3.2
        $popularMedia = new mediaList($sql);
        // Create a new mediaList object
        if ($returnRows = $popularMedia->getRows()) {
            //echo "test: ".$returnRows; exit;
            $popularMedia->getMediaDetails();
            // Run the getMediaDetails function to grab all the media file details
            $popularMedia->addThumbDetails = true;
            // Get the thumb details as part of the array
            $popularMediaArray = $popularMedia->getMediaArray();
            // Get the array of popular media
            $popularMediaDetailsFields = $popularMedia->getDetailsFields('thumb');
            if ($popularMediaDetailsFields) {
                $thumbMediaDetailsArray = $thumbMediaDetailsArray + $popularMediaDetailsFields;
            }
            // Get the output for the details shown under thumbnails
            $smarty->assign('popularMediaRows', $returnRows);
            // Assign to smarty
            $smarty->assign('popularMedia', $popularMediaArray);
            // Assign to smarty
        }
    } catch (Exception $e) {
        die(exceptionError($e));
    }
}
//print_r($featuredMediaDetailsArray);
//$thumbMediaDetailsArray = array_merge($featuredMediaDetailsArray,$newestMediaDetailsArray,$randomMediaDetailsArray,$popularMediaDetailsArray);