在codeigniter中包含php内的html图像标签

时间:2014-12-01 05:53:35

标签: php html codeigniter

<?php foreach($fullmap as $tr)
    {
    $map->addMarkerByAddress($tr->latitude.','.$tr->longitude, " ", '<h3>'.$tr->restaurant_name.'</h3><img width="80" height="80" src="'.base_url().$tr->images.'" class="img-circle" alt="user1" style="width:50px; height:50px;"><p>'.$tr->description.'<a href="'.site_url('main/restros_quick_view').'?restro_id='.$tr->restaurant_id.'" class="three-inner-detail">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">Detail</span></a></p>', "http://demos.thesoftwareguy.in/google-map1/icons/islam.png" );
    } ?>

你好朋友上面的代码工作正常,但正如你在最后一行看到的从链接显示图标,但我需要显示我自己的图标,所以我怎么能在php.my图标里面写img src标签是在图像文件夹中,图标的名称是test1.jpg,我正在使用codeigniter框架工作

1 个答案:

答案 0 :(得分:0)

无需将IMG标记设为Google标记,只需要 图像路径 ,因此只需提供路径,img标记将仅按地图添加。

<?php foreach($fullmap as $tr)
{
$map->addMarkerByAddress($tr->latitude.','.$tr->longitude, " ", '<h3>'.$tr->restaurant_name.'</h3><img width="80" height="80" src="'.base_url().$tr->images.'" class="img-circle" alt="user1" style="width:50px; height:50px;"><p>'.$tr->description.'<a href="'.site_url('main/restros_quick_view').'?restro_id='.$tr->restaurant_id.'" class="three-inner-detail">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">Detail</span></a></p>', base_url() . "assets/images/icon.png" );
} ?>

你可以写这个base_url() . "assets/images/icon.png"