Welcome Guest, Not a member yet? Register   Sign In
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>




Theme © iAndrew 2016 - Forum software by © MyBB