個人用ツール

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

提供: baserCMS公式ガイド

移動: 案内, 検索
(ページの作成:「## 説明 ページタイトルとコンテンツタイトルを出力します。 ## 使い方 <syntaxhighlight lang="php"> echo $this->BcBaser->getTitle( [$separator]...」)
 
(description追加)
 
(3人の利用者による、間の10版が非表示)
行1: 行1:
 +
<metadesc>baserCMSのビューヘルパー関数BcBaser getTitleでは、タイトルタグの内容を取得することができます。</metadesc>
 +
 
## 説明  
 
## 説明  
ページタイトルとコンテンツタイトルを出力します。
+
タイトルタグを取得する。
 +
 
 +
ページタイトルと直属のカテゴリ名が同じ場合は、ページ名を省略します。
  
 
## 使い方
 
## 使い方
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
echo $this->BcBaser->getTitle( [$separator] , [$categoriTitleOn] )
+
$this->BcBaser->getTitle( [$separator] , [$categoriTitleOn] )
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
## パラメータ
 
## パラメータ
$separator
+
(string)$separator
: コンテンツのタイトルとコンテンツのタイトルの間のセパレーターを出力
+
: コンテンツタイトルとページタイトルの間のセパレーターを指定する
 
: 初期値は'|'(縦棒)
 
: 初期値は'|'(縦棒)
  
$categoriTitleOn
+
(string)$categoriTitleOn
: カテゴリタイトルの出力有無。もしくは、カテゴリ名として出力したい文字を指定する
+
: カテゴリタイトルを表示するかどうか boolean で指定する
 
: 初期値:null
 
: 初期値:null
  
 
## 戻り値
 
## 戻り値
 
(string)  
 
(string)  
: コンテンツのタイトル (セパレーター) ページのタイトル
+
: コンテンツタイトル 【セパレータ】 カテゴリ 【セパレータ】 ページタイトル
  
 
## 用例
 
## 用例
行24: 行28:
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
<?php echo $this->BcBaser->getTitle();  ?>
+
<?php $this->BcBaser->getTitle();  ?>
 
</syntaxhighlight>
 
</syntaxhighlight>
  
####出力
+
####取得
 
<syntaxhighlight lang="html5">
 
<syntaxhighlight lang="html5">
コンテンツタイトル  | ページタイトル
+
コンテンツタイトル  | (カテゴリ)| ページタイトル
 
</syntaxhighlight>
 
</syntaxhighlight>
  
行35: 行39:
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
<?php echo $this->BcBaser->getTitle('/', '変更したページタイトル'); ?>
+
<?php $this->BcBaser->getTitle('/', false); ?>
 
</syntaxhighlight>
 
</syntaxhighlight>
  
####出力
+
####取得
 
<syntaxhighlight lang="html5">
 
<syntaxhighlight lang="html5">
コンテンツタイトル  / 変更したページタイトル
+
コンテンツタイトル  / ページタイトル
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
(カテゴリーが出力されない)
  
 
## 注
 
## 注
行54: 行59:
 
[getImg](/関数リファレンス/getContentsTitle)
 
[getImg](/関数リファレンス/getContentsTitle)
  
[[Category:関数]]
+
[[Category:関数リファレンス]]

2016年8月26日 (金) 11:29時点における最新版

説明

タイトルタグを取得する。

ページタイトルと直属のカテゴリ名が同じ場合は、ページ名を省略します。

使い方

$this->BcBaser->getTitle( [$separator] , [$categoriTitleOn] )

パラメータ

(string)$separator
コンテンツタイトルとページタイトルの間のセパレーターを指定する
初期値は'|'(縦棒)
(string)$categoriTitleOn
カテゴリタイトルを表示するかどうか boolean で指定する
初期値:null

戻り値

(string)
コンテンツタイトル 【セパレータ】 カテゴリ 【セパレータ】 ページタイトル

用例

基本

コード

<?php $this->BcBaser->getTitle();  ?>

取得

コンテンツタイトル  | (カテゴリ)| ページタイトル

応用

コード

<?php $this->BcBaser->getTitle('/', false); ?>

取得

コンテンツタイトル  / ページタイトル

(カテゴリーが出力されない)

変更履歴

ソースファイル

関連資料

類似の関数

getImg