public function NewsArchiveByHolderID($holderID = null, $limit = 5)
    {
        $filter = array(
            'Live'                 => 1,
            'NewsHolderPageID'     => $holderID,
            'PublishFrom:LessThan' => SS_Datetime::now()->Rfc2822(),

        );
        if ($limit === 0) {
            $limit = null;
        }
        if (class_exists('Translatable')) {
            $filter['Locale'] = Translatable::get_current_locale();
        }
        $news = News::get()
            ->filter($filter)
            ->limit($limit);

        if ($news->count() === 0) {
            return null;
        }

        return $news;
    }
public function NewsArchiveByHolderID($holderID = null, $limit = 5)
    {
        $filter = array(
            'Live'                 => 1,
            'NewsHolderPageID'     => $holderID,
            'PublishFrom:LessThan' => SS_Datetime::now()->Rfc2822(),

        );
        if ($limit === 0) {
            $limit = null;
        }
        if (class_exists('Translatable')) {
            $filter['Locale'] = Translatable::get_current_locale();
        }
        $news = News::get()
            ->filter($filter)
            ->limit($limit);

        if ($news->count() === 0) {
            return null;
        }

        return $news;
    }
public function NewsArchiveByHolderID ( $ holderID = null , $ limit = 5 ) { $ filter = array ( 'Live' => 1 , 'NewsHolderPageID' => $ holderID , 'PublishFrom:LessThan' => SS_Datetime :: now ( ) -> Rfc2822 ( ) , ) ; if ( $ limit === 0 ) { $ limit = null ; } if ( class_exists ( 'Translatable' ) ) { $ filter [ 'Locale' ] = Translatable :: get_current_locale ( ) ; } $ news = News :: get ( ) -> filter ( $ filter ) -> limit ( $ limit ) ; if ( $ news -> count ( ) === 0 ) { return null ; } return $ news ; }
Get all the items from a single newsholderPage.

@param int $holderID
@param     $limit integer with chosen limit. Called from template via <% loop $NewsArchiveByHolderID(321,5) %> for the page with ID 321 and 5 latest items.

@todo   many things, isn't finished
@fixed  I refactored a bit. Only makes for a smaller function.
@author Marcio Barrientos
@return ArrayList|News[]
Get all the items from a single newsholderPage .