如何在Drupal中为图像添加工具提示?使用自定义模板
我正在使用 Drupal 6.x。这是我的 node-product.tpl.php 模板上的代码。我为产品创建了一个自定义 jquery 库。它工作得很好,但我只是缺少图像中的工具提示(大缩略图和小缩略图)。为了上传图像,我使用了名为 field_images 的 CCK 字段。当我上传图像时,我在那里输入图像标题。如何添加工具提示代码片段以使其正常工作?
<div class="product-large">
<img src="/sites/default/files/imagecache/360x280/<?php print $node->field_images[0]['filename']; ?>" />
</div>
<div class="product-small">
<?php
// get all images
foreach ($node->field_images as $images) {
?>
<img src="/sites/default/files/imagecache/120x90/<?php print $images['filename']; ?>" rel="/sites/default/files/imagecache/360x280/<?php print $images['filename']; ?>" />
<?php
}
?>
</div>
非常感谢!
克里斯
I'm using Drupal 6.x. This is my code on my node-product.tpl.php template. I've created a custom jquery gallery for the products. It works great, but I'm just missing tool tips from my images (both large and small thumbnails). To upload images I'm using a CCK field named field_images. There I input the image titles when I upload the images. How can I add the tool tip code snippet to make it work?
<div class="product-large">
<img src="/sites/default/files/imagecache/360x280/<?php print $node->field_images[0]['filename']; ?>" />
</div>
<div class="product-small">
<?php
// get all images
foreach ($node->field_images as $images) {
?>
<img src="/sites/default/files/imagecache/120x90/<?php print $images['filename']; ?>" rel="/sites/default/files/imagecache/360x280/<?php print $images['filename']; ?>" />
<?php
}
?>
</div>
Thanks much appreciated!
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“工具提示”是
title
HTML 属性的结果。您需要将title="foo"
添加到img
标记中。也许:
对于第二个图像,类似
$node->field_images[0]['data'] ['title']
为第一个。The "tooltip" is a result of the
title
HTML attribute. You'll want to addtitle="foo"
to yourimg
tag.Perhaps:
<img src="/sites/default/files/imagecache/120x90/<?php print $images['filename']; ?>" rel="/sites/default/files/imagecache/360x280/<?php print $images['data']['filename']; ?>" title="<?php print $images['title']; ?>"/>
for the second image and similarly$node->field_images[0]['data']['title']
for the first.