0
嘗試使用gmap列出一堆地址。Codeigniter gmap在視圖中添加標記而不是控制器
守則控制器都有這個初始化步驟:
$this->load->library('GMap');
$this->gmap->GoogleMapAPI();
$this->gmap->setMapType('map');
使用爲下文相同功能的addMarkerByAddress說那是工作:
$this->gmap->addMarkerByAddress($address,$ordername, $ordertitle, $tooltip, $icon_leaf);
當我嘗試在視圖中相同的代碼文件失敗。我知道如何將數據傳遞給視圖以進行顯示(使用$data[]
變量),但是如何從主文件獲取gmap實例,以便可以在視圖中引用它?
你可以使用'$ data ['gmap'] = $ this-> gmap;'' – dennismonsewicz 2014-10-02 19:05:04