如何生成'a href =" javascript:void(0)"'喜欢链接在cakephp? [英] How to generate 'a href="javascript:void(0)"' like link in cakephp?
问题描述
如何在CakePHP中生成'a href =javascript:void(0)'like link?
How to generate 'a href="javascript:void(0)"' like link in CakePHP?
我创建一个应用程序,当用户点击图像列表时,内容将插入到编辑器textarea中。我向这些图像添加一个类,并在javascript文件中写一些代码。一切进行得都很顺利。
I make an application, the content will insert into the editor textarea when user click a list of image. I add a class to these images and write some code in the javascript file. Everything is going well.
但是图片的链接是一个URL地址,但不是'href =javascript:void(0)'像URL。任何人都可以告诉我如何做在CakePHP中?
But the link of the image is a URL address, but not 'href="javascript:void(0)' like URL. Anyone could tell me how to make it in CakePHP?
提前感谢!
推荐答案
<?php
echo $this->Html->link(
'/path/to/image/',
'javascript:void(0)'
);
?>
到图像或使用Html助手生成图像标记代码。第二个参数将设置href。
You can either set a path to the image or use the Html helper to generate the image tag code. The second parameter will set the href.
这篇关于如何生成'a href =" javascript:void(0)"'喜欢链接在cakephp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!