「関数リファレンス/BcBaser img」の版間の差分
提供: baserCMS公式ガイド
行25: | 行25: | ||
####コード | ####コード | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
− | <?php $this->BcBaser->img( | + | <?php $this->BcBaser->img('logo.png', array('alt'=>'ロゴ')); ?> |
</syntaxhighlight> | </syntaxhighlight> | ||
####出力 | ####出力 | ||
<syntaxhighlight lang="html5"> | <syntaxhighlight lang="html5"> | ||
− | <img src="/app/webroot/theme/hoge/img/logo.png"> | + | <img src="/app/webroot/theme/hoge/img/logo.png" alt="ロゴ"> |
</syntaxhighlight> | </syntaxhighlight> | ||
2015年3月5日 (木) 20:20時点における版
目次
説明
画像読み込みタグを出力します。
使い方
$this->BcBaser->img( $path , [$options] );
パラメータ
- $path
-
画像ファイルまでのパス。先頭にスラッシュをつけた場合は、/app/webroot/ からのパスとなる。スラッシュをつけず相対パスとした場合は、/app/webroot/img/ からのパスとなる。テーマを使用している場合は、/app/webroot/theme/{テーマ名}/imgからのパスとなる。
- 初期値:−
- $options
-
要素の属性等
- 初期値:array()
戻り値
(string) 画像タグ
用例
基本
コード
<?php $this->BcBaser->img('logo.png', array('alt'=>'ロゴ')); ?>
出力
<img src="/app/webroot/theme/hoge/img/logo.png" alt="ロゴ">