簡體   English   中英

如何在Drupal中為圖像添加工具提示? 使用自定義模板

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM