個人用ツール

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

提供: baserCMS公式ガイド

移動: 案内, 検索
行6: 行6:
 
$this->BcBaser->getContentsTitle()
 
$this->BcBaser->getContentsTitle()
 
</syntaxhighlight>
 
</syntaxhighlight>
 
## パラメータ
 
$path
 
: (文字列) (必須)画像ファイルまでのパス
 
: 初期値なし
 
: 先頭にスラッシュをつけた場合は、/app/webroot/ からのパスとなる。
 
: スラッシュをつけず相対パスとした場合は、/app/webroot/img/ からのパスとなる。
 
: テーマを使用している場合は、/app/webroot/themed/{テーマ名}/imgからのパスとなる。
 
 
$options
 
: (文字列)img要素の属性等を任意で連想配列で指定
 
 
    - 初期値:array()
 
    - 'value1':値が入ります
 
    - 'value2':値が入ります
 
    - 'value3':値が入ります
 
    - 'value4':値が入ります
 
    - 'value5':値が入ります
 
  
 
## 戻り値
 
## 戻り値
 
(string)  
 
(string)  
: imgタグ
+
: コンテンツタイトル
  
 
## 用例
 
## 用例
行33: 行15:
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
<?php $this->BcBaser->getImg("/common/img/logo.png"); ?>
+
<?php $this->BcBaser->getContentsTitle(); ?>
</syntaxhighlight>
+
 
+
####出力
+
<syntaxhighlight lang="html5">
+
<img src="/app/webroot//common/img/logo.png">
+
</syntaxhighlight>
+
 
+
### 応用
+
####コード
+
<syntaxhighlight lang="php">
+
<?php $this->BcBaser->getImg("/common/img/logo.png", array('alt'=>'この画像の代替テキストです', 'class'=>'testImg', 'width'=>'200px', 'height'=>'160px') ); ?>
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
####出力
 
####出力
 
<syntaxhighlight lang="html5">
 
<syntaxhighlight lang="html5">
<img src='/app/webroot//common/img/logo.png' alt='この画像の代替テキストです' class='testImg' width='200px' height='160px'>
+
このコンテンツのタイトル
 
</syntaxhighlight>
 
</syntaxhighlight>
  
行61: 行32:
  
 
##類似の関数
 
##類似の関数
[getImg](/関数リファレンス/getImg)
+
[$this->BcBaser->getTitle()](/関数リファレンス/$this->BcBaser->getTitle())
  
 
[[Category:関数]]
 
[[Category:関数]]

2014年11月2日 (日) 10:31時点における版

説明

$this->BcBaser->getTitle()では、サイト名やカテゴリ名等を含んだタイトルを取得できますが、$this->BcBaser->getContentsTitle()では、純粋にコンテンツページのタイトルのみを取得できます。

使い方

$this->BcBaser->getContentsTitle()

戻り値

(string)
コンテンツタイトル

用例

基本

コード

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

出力

このコンテンツのタイトル

変更履歴

ソースファイル

関連資料

類似の関数

$this->BcBaser->getTitle()