![](/img/trans.png)
[英]How to add the help text of a custom module in a separate template file in Drupal 8?
[英]How to add tool tip for image in Drupal? Using custom template
我正在使用Drupal6.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>
非常感谢!
克里斯
“工具提示”是title
HTML属性的结果。 您需要将title="foo"
添加到您的img
标签中。
也许: <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']; ?>"/>
用于第二个图像,类似地, $node->field_images[0]['data']['title']
首先。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.