简体   繁体   中英

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).

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM