[英]cakephp, how can I add a class to the url instead of the image
I wonder what is the most cakey way to do this. 我想知道什么是最容易做的事。 When I do: 当我做:
echo $this->Html->image('uploadimage.gif', array('alt'=>'Upload Image', 'class'=>'nyroModal', 'url'=>'#test'));
It outputs: 它输出:
<a href="#test"><img src="/img/uploadimage.gif" alt="Upload Image" class="nyroModal" /></a>
I need it to be: 我需要它是:
<a href="#test" class="nyroModal"><img src="/img/uploadimage.gif" alt="Upload Image"/></a>
IE the class is applied to the link rather than the image. IE将该类应用于链接而不是图像。 How can I do that? 我怎样才能做到这一点?
thanks :) 谢谢 :)
I have never used cakePHP but for what I read online instead of giving a url to the image you can do it the other way around, create a link and pass an image, the result should be something like this: 我从未使用过cakePHP,但是对于我在网上阅读的内容,除了提供图像的URL外,您可以使用另一种方法,创建链接并传递图像,结果应该是这样的:
<?php
echo $this->Html->link(
$this->Html->image("uploadimage.gif", array("alt" => "Upload Image")),
"#test",
array("escape" => "false", "class" => "nyroModal")
);
?>
For more info on link
you can go here: http://book.cakephp.org/view/1442/link 有关link
更多信息,请访问此处: http : //book.cakephp.org/view/1442/link
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.