関数リファレンス/BcBaser getContentsTitle
提供: baserCMS公式ガイド
目次
説明
$this->BcBaser->getTitle()では、サイト名やカテゴリ名等を含んだタイトルを取得できますが、$this->BcBaser->getContentsTitle()では、純粋にコンテンツページのタイトルのみを取得できます。
使い方
$this->BcBaser->getContentsTitle()
パラメータ
- $path
- (文字列) (必須)画像ファイルまでのパス
- 初期値なし
- 先頭にスラッシュをつけた場合は、/app/webroot/ からのパスとなる。
- スラッシュをつけず相対パスとした場合は、/app/webroot/img/ からのパスとなる。
- テーマを使用している場合は、/app/webroot/themed/{テーマ名}/imgからのパスとなる。
- $options
-
(文字列)img要素の属性等を任意で連想配列で指定
- 初期値:array()
- 'value1':値が入ります
- 'value2':値が入ります
- 'value3':値が入ります
- 'value4':値が入ります
- 'value5':値が入ります
戻り値
- (string)
- imgタグ
用例
基本
コード
<?php $this->BcBaser->getImg("/common/img/logo.png"); ?>
出力
<img src="/app/webroot//common/img/logo.png">
応用
コード
<?php $this->BcBaser->getImg("/common/img/logo.png", array('alt'=>'この画像の代替テキストです', 'class'=>'testImg', 'width'=>'200px', 'height'=>'160px') ); ?>
出力
<img src='/app/webroot//common/img/logo.png' alt='この画像の代替テキストです' class='testImg' width='200px' height='160px'>