Search code examples
phptwitter-bootstrapcodeignitertwitter-bootstrap-tooltip

Bootstrap 3 tooltip with PHP / CodeIgniter


I'm adding html to my page via PHP and can't seem to get my bootstrap tooltip image to work to function properly.

<li class="list-group-item col-lg-3 col-md-3 col-sm-3 col-xs-3"><a href="'.site_url(url_title($artist['firstname'].' '.$artist['lastname']).'-a'.$artist['id']).'" data-toggle="tooltip" data-placement="auto" data-html="true" title="<img src="'.base_url('image/get/resize/'.IMAGE_RESIZE_AND_CROP.'/width/200/height/150/id/'.$artwork[0]['image_id']).'">">'.$artist['firstname'].' '.strtoupper($artist['lastname']).'</a></li>

The problem is located in my tooltip title:

title="<img src="'.base_url('image/get/resize/'.IMAGE_RESIZE_AND_CROP.'/width/200/height/150/id/'.$artwork[0]['image_id']).'">"

Result: Screenshot

The names appear this way: ">Raymond ABNER and there is nothing in the tooltips. From what I conclude, the problem is possibly in my usage of " and ', but I can't find a workaround (also, not sure about this).


Solution

  • Just found the answer... The " within my src= where the problem. Took them off and it works fine.

    Final code segment:

    <li class="list-group-item col-lg-3 col-md-3 col-sm-3 col-xs-3"><a href="'.site_url(url_title($artist['firstname'].' '.$artist['lastname']).'-a'.$artist['id']).'" data-toggle="tooltip" data-placement="auto" data-html="true" title="<img src='.base_url('image/get/resize/'.IMAGE_RESIZE_AND_CROP.'/width/200/height/150/id/'.$artwork[0]['image_id']).'>">'.$artist['firstname'].' '.strtoupper($artist['lastname']).'</a></li>