public function NewsArchive($limit = 5, $random = null, $related = null)
    {
        if ($limit === 0) {
            $limit = null;
        }
        $params = $this->owner->getURLParams();
        $otherNews = null;
        /** @var News $otherNews */
        if ($related) {
            $otherNews = $this->owner->getNews();
        }
        if (($otherNews && $otherNews->Tags()->count()) || !$related) {
            return $this->getArchiveItems($otherNews, $limit, $random, $related, $params);
        }
    }
public function NewsArchive($limit = 5, $random = null, $related = null)
    {
        if ($limit === 0) {
            $limit = null;
        }
        $params = $this->owner->getURLParams();
        $otherNews = null;
        /** @var News $otherNews */
        if ($related) {
            $otherNews = $this->owner->getNews();
        }
        if (($otherNews && $otherNews->Tags()->count()) || !$related) {
            return $this->getArchiveItems($otherNews, $limit, $random, $related, $params);
        }
    }
public function NewsArchive ( $ limit = 5 , $ random = null , $ related = null ) { if ( $ limit === 0 ) { $ limit = null ; } $ params = $ this -> owner -> getURLParams ( ) ; $ otherNews = null ; /** @var News $otherNews */ if ( $ related ) { $ otherNews = $ this -> owner -> getNews ( ) ; } if ( ( $ otherNews && $ otherNews -> Tags ( ) -> count ( ) ) || ! $ related ) { return $ this -> getArchiveItems ( $ otherNews , $ limit , $ random , $ related , $ params ) ; } }
Get all, or a limited, set of items.

@param $limit   integer with chosen limit. Called from template via <% loop NewsArchive(5) %> for the 5 latest items.
@param $random  boolean Called from template. e.g. <% loop NewsArchive(5,1) %> to show random posts, related via the tags.
@param $related boolean Called from template. e.g. <% loop NewsArchive(5,0,1) %> to show just the latest 5 related items.
Or, to show 5 random related items, use <% loop NewsArchive(5,1,1) %>. You're free to play with the settings :)
To loop ALL items, set the first parameter (@param $limit ) to zero. As you can see.

@return DataList|News[]
@todo implement subsites
Get all or a limited set of items .