個人用ツール

「ver4/関数リファレンス/getPostDetail」の版間の差分

提供: baserCMS公式ガイド

移動: 案内, 検索
行1: 行1:
[このコンテンツは内容調整中です]
 
 
 
## 説明
 
## 説明
 
記事の詳細を取得する
 
記事の詳細を取得する
行21: 行19:
 
## 戻り値
 
## 戻り値
 
(string)
 
(string)
記事本文
+
: 記事本文
 
 
 
## 用例
 
## 用例
行27: 行25:
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
 +
$BlogPost = ClassRegistry::init('BlogPost');
 +
$post = $BlogPost->find('first', ['conditions' => ['BlogPost.id' => 1]]);
 +
$this->Blog->getPostDetail($post);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
####出力
 
####出力
<syntaxhighlight lang="html5">
+
IDが1のブログ記事本文
</syntaxhighlight>
+
  
 
### 応用
 
### 応用
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
 
+
$BlogPost = ClassRegistry::init('BlogPost');
 +
$post = $BlogPost->find('first', ['conditions' => ['BlogPost.id' => 1]]);
 +
$options = ['cut' => 30];
 +
$this->Blog->getPostDetail($post, $options);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
####出力
 
####出力
<syntaxhighlight lang="html5">
+
30文字にカットされたIDが1のブログ記事本文
 
+
</syntaxhighlight>
+
 
+
## 注
+
 
+
## 変更履歴
+
 
+
## ソースファイル
+
 
+
## 関連資料
+
  
##類似の関数
 
 
[[Category:関数リファレンスver4]]
 
[[Category:関数リファレンスver4]]

2018年6月11日 (月) 13:41時点における版

説明

記事の詳細を取得する

使い方

$this->Blog->getPostDetail( [$post] , [$options] )

パラメータ

(array) $post
記事データ
(array) $options
オプション 初期値 : array()
  • cut : 文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)

戻り値

(string)
記事本文

用例

基本

コード

$BlogPost = ClassRegistry::init('BlogPost');
$post = $BlogPost->find('first', ['conditions' => ['BlogPost.id' => 1]]);
$this->Blog->getPostDetail($post);

出力

IDが1のブログ記事本文

応用

コード

$BlogPost = ClassRegistry::init('BlogPost');
$post = $BlogPost->find('first', ['conditions' => ['BlogPost.id' => 1]]);
$options = ['cut' => 30];
$this->Blog->getPostDetail($post, $options);

出力

30文字にカットされたIDが1のブログ記事本文