ver4/関数リファレンス/getBlogs
提供: baserCMS公式ガイド
[このコンテンツは内容調整中です]
目次
説明
ブログの基本情報(説明、設定、表示件数、コメント許可など)を全て取得する。
使い方
<?php $this->BcBaser->getBlogs( $name , [$options] ); ?>
パラメータ
- (string) $name
- ブログアカウント名を指定するとそのブログのみの基本情報を返す。
空指定(default)で、全てのブログの基本情報。 - - 初期値 :’ ’
- (array) $options
- オプション
- - 初期値 :array()
sort
: データのソート順 取得出来るフィールドのどれかでソートができる ex) 'created DESC'(初期値 : 'id')
siteId
: サブサイトIDで絞り込む場合に指定する(初期値:0
戻り値
- (array)
- サイト基本設定配列
用例
基本
全てのブログの基本情報を出力する。
コード
<?php var_dump($this->BcBaser->getBlogs()); ?>
出力
全ブログの情報が配列で出力される
array(3) { [0]=> array(23) { ["id"]=> string(1) "1" ["name"]=> string(4) "news" ["title"]=> string(12) "新着情報" ["description"]=> string(65) "baserCMS inc. [デモ] の最新の情報をお届けします。" ["layout"]=> string(7) "default" ["template"]=> string(7) "default" ["status"]=> bool(true) ["list_count"]=> string(2) "10" ["list_direction"]=> string(4) "DESC" ["feed_count"]=> string(2) "10" ["tag_use"]=> bool(true) ["comment_use"]=> string(1) "1" ["comment_approve"]=> string(1) "0" ["auth_captcha"]=> bool(true) ["widget_area"]=> string(1) "2" ["exclude_search"]=> bool(false) ["use_content"]=> bool(true) ["created"]=> string(19) "2016-02-02 21:01:37" ["modified"]=> NULL ["eye_catch_size_thumb_width"]=> string(3) "300" ["eye_catch_size_thumb_height"]=> string(3) "300" ["eye_catch_size_mobile_thumb_width"]=> string(3) "100" ["eye_catch_size_mobile_thumb_height"]=> string(3) "100" } [1]=> array(23) { ["id"]=> string(1) "2" ["name"]=> string(6) "course" ["title"]=> string(6) "講座" // (省略) } [2]=> array(23) { ["id"]=> string(1) "3" ["name"]=> string(10) "staff-blog" ["title"]=> string(21) "スタッフブログ" // (省略) } }
応用
コード
(例)news ブログの場合
<?php var_dump($this->BcBaser->getBlogs('news')); ?>
出力
news ブログの情報が配列出力される
array(3) { [0]=> array(23) { ["id"]=> string(1) "1" ["name"]=> string(4) "news" ["title"]=> string(12) "新着情報" ["description"]=> string(65) "baserCMS inc. [デモ] の最新の情報をお届けします。" ["layout"]=> string(7) "default" ["template"]=> string(7) "default" ["status"]=> bool(true) ["list_count"]=> string(2) "10" ["list_direction"]=> string(4) "DESC" ["feed_count"]=> string(2) "10" ["tag_use"]=> bool(true) ["comment_use"]=> string(1) "1" ["comment_approve"]=> string(1) "0" ["auth_captcha"]=> bool(true) ["widget_area"]=> string(1) "2" ["exclude_search"]=> bool(false) ["use_content"]=> bool(true) ["created"]=> string(19) "2016-02-02 21:01:37" ["modified"]=> NULL ["eye_catch_size_thumb_width"]=> string(3) "300" ["eye_catch_size_thumb_height"]=> string(3) "300" ["eye_catch_size_mobile_thumb_width"]=> string(3) "100" ["eye_catch_size_mobile_thumb_height"]=> string(3) "100" } }