Airship\Cabin\Hull\Blueprint\Blog::listBaseSeries PHP Method

listBaseSeries() public method

Get all of the base series
public listBaseSeries ( integer $num = 20, integer $offset ) : array
$num integer
$offset integer
return array
    public function listBaseSeries(int $num = 20, int $offset = 0) : array
    {
        $items = $this->db->run('SELECT
                s.*,
                COALESCE(i.listorder, s.seriesid) AS listorder
            FROM
                hull_blog_series s
            LEFT OUTER JOIN
                hull_blog_series_items i
                ON
                    i.series = s.seriesid
            WHERE
                i.parent IS NULL
                AND s.seriesid IS NOT NULL
            ORDER BY
                listorder ASC
            OFFSET ' . $offset . '
            LIMIT ' . $num);
        if (empty($items)) {
            return [];
        }
        return $items;
    }

Usage Example

コード例 #1
0
ファイル: BlogPosts.php プロジェクト: paragonie/airship
 /**
  * List all of the blog posts for a given year
  *
  * @route blog/series
  */
 public function listSeries()
 {
     list($offset, $limit) = $this->getOffsetAndLimit();
     $count = $this->blog->countSeries();
     $series_items = $this->blog->listBaseSeries($limit, $offset);
     $args = ['series' => ['name' => \__('Series Index')], 'pageTitle' => \__('Series Index'), 'series_items' => $series_items, 'pagination' => ['base' => \Airship\LensFunctions\cabin_url() . 'blog/series/', 'suffix' => '/?page=', 'count' => $count, 'page' => (int) \ceil($offset / ($limit ?? 1)) + 1, 'per_page' => $limit]];
     $this->config('blog.cachelists') ? $this->stasis('blog/series', $args) : $this->lens('blog/series', $args);
 }