最新版 |
編集中の文章 |
行1: |
行1: |
− | ## 説明 | + | ## 説明 |
− | ブログ記事一覧出力
| + | 説明文サンプルテキスト。 |
| + | |
| | | |
| ## 使い方 | | ## 使い方 |
− | <syntaxhighlight lang="php"> | + | ```php |
− | $this->BcBaser->blogPosts( $contentsName, [$num] , [$options] ); | + | <code><?php echo $testtest ?></code> |
− | </syntaxhighlight> | + | ``` |
| | | |
− | ## パラメータ
| |
− | (文字列)$contentsName
| |
− | : 管理システムで指定したコンテンツ名
| |
− | : 初期値 nul :全てのブログが取得対象に
| |
| | | |
− | (数値)$num
| + | ## 引数 |
− | : 記事件数
| + | あり・なし |
− | : 初期値:5
| + | |
| | | |
− | (array)$options
| |
− | : オプション
| |
− |
| |
− | - 初期値:array()
| |
− | - 'category':カテゴリで絞り込む場合にアルファベットのカテゴリ名指定(初期値 : null)
| |
− | - 'tag':タグで絞り込む場合にタグ名を指定(初期値 : null)
| |
− | - 'year':年で絞り込む場合に年を指定(初期値 : null)
| |
− | - 'month':月で絞り込む場合に月を指定(初期値 : null)
| |
− | - 'day':日で絞り込む場合に日を指定(初期値 : null)
| |
− | - 'id':id で絞り込む場合に id を指定(初期値 : null)
| |
− | - 'keyword':キーワードで絞り込む場合にキーワードを指定(初期値 : null)
| |
− | - 'template':読み込むテンプレート名を指定する場合にテンプレート名を指定(初期値 : null)
| |
− | - 'contentsTemplate':どのブログのテンプレート名を利用するか''ブログ名''(news等)を指定(初期値 : null)※3.0.10で実装。指定方法が変更する可能性アリ
| |
− | - `direction` : 並び順の方向を指定 [昇順:ASC or 降順:DESC](初期値 : null)
| |
− | - `sort` : 並び替えの基準となるフィールドを指定(初期値 : null)
| |
− | - `page` : ページ数を指定(初期値 : null)
| |
− |
| |
− | ## 戻り値
| |
− | なし
| |
| | | |
| ## 用例 | | ## 用例 |
− | ### 基本
| |
− | ####コード
| |
− | <syntaxhighlight lang="php">
| |
− | <?php $this->BcBaser->blogPosts('news', 5); ?>
| |
− | </syntaxhighlight>
| |
− |
| |
− | ####出力
| |
− | <syntaxhighlight lang="html5">
| |
− | <ul>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/5">ホームページをオープンしました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/4">新商品を販売を開始しました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/3">ホームページをオープンしました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/2">新商品を販売を開始しました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/1">ホームページをオープンしました。</a></span></li>
| |
− | </ul>
| |
− | </syntaxhighlight>
| |
− |
| |
− | ### 応用
| |
− | ####コード
| |
− | <syntaxhighlight lang="php">
| |
− | <?php $this->BcBaser->blogPosts('news', 3, array('category'=>'release', 'year'=>'2014', 'template'=>'posts')); ?>
| |
− | </syntaxhighlight>
| |
− |
| |
− | ####出力
| |
− | <syntaxhighlight lang="html5">
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/3">ホームページをオープンしました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/2">新商品を販売を開始しました。</a></span></li>
| |
− | <li><span class="date">2014.11.2</span><span class="title"><a href="/news/archives/1">ホームページをオープンしました。</a></span></li>
| |
− | </syntaxhighlight>
| |
− |
| |
− | ####コード
| |
− | ブログの詳細記事表示中に、同じカテゴリの記事を関連記事として表示させたい場合
| |
− | <syntaxhighlight lang="php">
| |
− | <?php $this->BcBaser->blogPosts('news', 3, array('category'=>$post['BlogCategory']['name'])); ?>
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | ####コード:全てのブログから最新記事を取得する
| |
− | <syntaxhighlight lang="php">
| |
− | <?php
| |
− | //全ブログから10件記事を取得
| |
− | $this->BcBaser->blogPosts(null, 10, array(
| |
− | 'contentsTemplate' => 'news' //どのブログ(post.php)を使うか
| |
− | ));
| |
− | ?>
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− | ## 注
| |
− |
| |
− | ## 変更履歴
| |
− |
| |
− | ## ソースファイル
| |
| | | |
− | ## 関連資料
| + | - なにをなにする |
| + | - なにをなにできる |
| | | |
− | ##類似の関数 | + | ### テキストを使ったほげほげ |
| + | なにをなにしてどうすることができます。 |
| | | |
− | [[Category:関数リファレンス]]
| + | ### タイトルを使ってほげほげなサンプル |
| + | なにをどうできる。これが一般的な方法です。 |
| + | サンプルコードの掲載 |