我正在使用 CakePHP 1.2。我正在尝试使用 CakePHP 的 jQuery Lazy ( http://jquery.eisbehr.de/lazy/example_basic-usage )。阅读https://book.cakephp.org/1.2/en/The-Manual/Core-Helpers/HTML.html#image上的文档,它显示了如何
<?php echo $html->image('cake_logo.png', array('alt' => 'CakePHP'))?>
产生以下输出:
<img src="/img/cake_logo.png" alt="CakePHP" />
我需要产生这个输出:
<img class="lazy" data-src="/img/cake_logo.png" />
如何$html->image()
在 CakePHP 1.2 中使用?问题在于,在语法image(string $path, array $htmlAttributes = array())
中,第一个参数是必需的,而在输出中它会产生 的src=...
属性img
。我需要一个<img... />
不包含该src=...
属性的输出。我如何在 CakePHP 中使用 $html->image() 来实现这一点?