個人用ツール

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

提供: baserCMS公式ガイド

移動: 案内, 検索
(ページの作成:「## 説明 $this->BcBaser->getTitle()では、サイト名やカテゴリ名等を含んだタイトルを取得できますが、$this->BcBaser->getContentsTitle()では...」)
 
行4: 行4:
 
## 使い方
 
## 使い方
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
$this->BcBaser->getImg( $path , [$options] );
+
$this->BcBaser->getContentsTitle()
 
</syntaxhighlight>
 
</syntaxhighlight>
  

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

説明

$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'>

変更履歴

ソースファイル

関連資料

類似の関数

getImg