トップページ >  CakePHP >  link
初版2009/12/03: 最終更新日2009/12/03
link
目次
link
link
リンクタグを出力する場合は、linkメソッドを使用します。
<?php echo $html->link('Enter', '/pages/home', array('class'=>'button')); ?>
そうすると、以下のように展開されます。
<a href="/ja/pages/home" class="button">Enter</a>


link() と image() を一緒に使用することで画像リンクを生成します。
<?php echo $html->link(
$html->image("recipes/6.jpg", array("alt" => "Brownies")),
"/recipes/view/6",
array(),
false,
false
); ?>
そうすると、以下のように展開されます。
<a href="/ja/recipes/view/6">
<img src="/img/recipes/6.jpg" alt="Brownies" />
</a>