handoyo
handoyo

Reputation: 81

image as anchor in codeigniter

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

alt text

Thanks...

Upvotes: 2

Views: 7252

Answers (3)

Nidheesh
Nidheesh

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

Marko Milosevic
Marko Milosevic

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

Iraklis
Iraklis

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

Related Questions