• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to link image with anchor function

#31
[eluser]Unknown[/eluser]
Code:
&lt;?php $img_edit = '<img src="'.base_url().'images/build/edit.png"/>'?&gt;
&lt;?php echo anchor('persons/edit/'.$query_person[$i]['id'], $img_edit);?&gt;

#32
[eluser]keld[/eluser]
I thought I would just add my two cents to this thread about embedding images in anchor tags
Code:
//Link + no title + Image + no alt
&lt;?php echo anchor("products/product/".$featured['nameuri'], img('images/featured/'.$featured['photo_featured'])); ?&gt;
outputs:
Code:
<a href="http://www.mysite.com/products/product/productname"><img src="http://www.mysite.com/images/featured/feat_105x145.png" alt=""/></a>
and
Code:
//Link + title + image + no alt
&lt;?php echo anchor("products/product/".$featured['nameuri'], img('images/featured/'.$featured['photo_featured']), 'title="'.$featured["name"].'"'); ?&gt;
outputs:
Code:
<a href="http://www.mysite.com/products/product/productname" title="My Title"><img src="http://www.mysite.com/images/featured/feat_105x145.png" alt=""/></a>
and
Code:
//Link + title + image + alt
&lt;?php echo anchor("products/product/".$featured['nameuri'], img(array('src'=>'images/featured/'.$featured['photo_featured'], 'alt'=>$featured["name"])), 'title="'.$featured["name"].'"'); ?&gt;
outputs:
Code:
<a href="http://www.mysite.com/products/product/productname" title="My Title"><img src="http://www.mysite.com/images/featured/feat_105x145.png" alt="My Alt"/></a>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.