Reputation: 510
I want to show a button with an imagen inside, but, I have a problem, the url of the image contains "base_url()" I mean...
<button type='button' class='btn btn-default btn-sm' id='deleteLevel'
value='".$key->cmpUsoID."'>
<img src='<?=base_url();?>static/images/delete.png' alt='Borrar' title='Borrar'>
</button>
all this code are in my Controller, and, when I paste it in a view, my image doesn't exists :( The view put static/images/delete.png instead of http://www.mycompany.com/project/static/images/delete.png
Do you know if it is possible to show an image by this way? or how I have to put the url of my image?
Upvotes: 1
Views: 2182
Reputation: 5398
Here is your code for view file
<button type='button' class='btn btn-default btn-sm' id='deleteLevel'
value='<?php echo $key->cmpUsoID;?>'>
<img src='<?php echo base_url('static/images/delete.png'); ?>' alt='Borrar' title='Borrar'>
</button>
if you need in controller then
$button = '<button type="button" class="btn btn-default btn-sm" id="deleteLevel"
value="'.$key->cmpUsoID.'">
<img src="'.base_url("static/images/delete.png").'" alt="Borrar" title="Borrar">
</button>';
Upvotes: 1