在 cakephp 1.3 中编写此帮助程序代码的正确方法是什么
我使用灯箱,但显示灯箱的代码有问题 而不是
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
我使用此代码进行查看
$thumb = $this->Html->image('images/thumb-1.jpg');
$full = $this->Html->image('/images/image-1.jpg', array('rel' => 'lightbox'));
echo $this->Html->link($thumb,$full, array('escape' => false));
,但我看到此错误
Error: The action <img src=" is not defined in controller ImagesController
Error: Create ImagesController::<img src="() in file: app\controllers\images_controller.php.
<?php
class ImagesController extends AppController {
var $name = 'Images';
function <img src="() {
}
}
?>
Notice: If you want to customize this error message, create app\views\errors\missing_action.ctp
i use light box but something wrong with this code to show light-box
instead of
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
i use this code for view
$thumb = $this->Html->image('images/thumb-1.jpg');
$full = $this->Html->image('/images/image-1.jpg', array('rel' => 'lightbox'));
echo $this->Html->link($thumb,$full, array('escape' => false));
but i see this error
Error: The action <img src=" is not defined in controller ImagesController
Error: Create ImagesController::<img src="() in file: app\controllers\images_controller.php.
<?php
class ImagesController extends AppController {
var $name = 'Images';
function <img src="() {
}
}
?>
Notice: If you want to customize this error message, create app\views\errors\missing_action.ctp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
翻译说明:
对于 Cake,这意味着将这些行放入
default.ctp
布局中,并将 Javascript 文件放入webroot/js
文件夹中。再次将其放入布局中,并将 css 文件放入
webroot/css
中。确保图像位于
webroot/img
中的正确位置,根据需要调整路径。您可以通过向链接帮助器添加属性来执行此操作:
Translating the instructions:
For Cake that means to put these lines into your
default.ctp
layout and the Javascript files into thewebroot/js
folder.Again, put this in the layout and the css file into
webroot/css
.Make sure the images are in the right location in
webroot/img
, adjust paths as necessary.In you do this by adding attributes to the link helper:
由于您没有列出您尝试过的任何代码,所以我假设您还没有开始集成。检查此链接,它有您需要的内容:
使用 CakePHP 的灯箱
Since you have not listed any code you tried, so i assume you've not started integration. Check this link, it have what you need:
Lightbox using CakePHP