Reputation: 81
how to make an image as an anchor in codeigniter? I've tried the following code,
echo anchor("admin/conf/edit/".$list['id'],img(array('src' => '../img/edit.jpg', 'alt' => "")));
It gives me a grey box like in the Actions column
Thanks...
Upvotes: 2
Views: 7252
Reputation: 37
You should first load the html helper class and then
$img = array('src' => '../img/edit.jpg','width'=>'25','height' =>"10");
echo anchor($path, img($img));
Should be good enough to work.
Upvotes: 1
Reputation: 1
This would work:
$path = 'admin/conf/edit/' .$list['id'];
$img = '<img src="../img/edit.jpg" alt="">';?>
echo anchor($path, $img);
And with html helper:
$img = array(
'src' => '../img/edit.jpg',
'alt' => ''
);
$path = 'admin/conf/edit/' .$list['id'];
echo anchor($path, img($img));
Upvotes: 0
Reputation: 2772
Try this:
anchor("admin/conf/edit/".$list['id'], img('src'=>'../img/edit.jpg','border'=>'0');
or
anchor("admin/conf/edit/".$list['id'], img('src'=>'../img/edit.jpg','style'=>'border:0px');
Upvotes: 2