Search code examples
joomla1.5joomla2.5virtuemart

Anchor tag image joomla


How can I use an image button instead of the text in the following code

JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'))

in HTML it is rendering as <a href="blah blah">Product details

How to use the image instead of Product details in HREF tag in above php code

JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'))

Solution

  • $product is a PHP object, and JHTML is used by joomla! framework to output links

    Actually your code:

    JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'))
    

    is equal to plain HTML

    <a href="<?php echo $product->link; ?>" title="<?php echo $product->product_name ?>" class="product-details"> <?php JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS');?></a>
    

    JText is used to output words and phrases based in a language INI file based in language/LANGUAGE_ID/folder. For english language and virtuemart component your string is located in /language/en-GB/en-GB.com_virtuemart.ini

    in order to use an image link try

    <a href="<?php echo $product->link; ?>" title="<?php echo $product->product_name ?>" class="product-details"> <img=src="myimage.png" /></a>