开发者

Maps on multiple pages. Create individual JS or a more efficient route?

I am utilizing the Google maps api v3 (Javascript).

I have made a code which displays various markers on the map, and finds the distance between the 'home' marker and each of the others.

It works perfectly.

On another page I need a map, 2 markers, and the route plotted between the two points. I can/have got this code. I am using CodeIgniter, and as such I could simply paste this code into my view file and voila.

My question is as follows: is there an easier way? Each map on each page is slightly different, and is dynamic. I am getting my lat/long vars from a database... as such having the JS in the view and adding a bit of PHP seems the best option - but this does mean some reproduction of code over numerous files (whic开发者_如何转开发h doesnt really matter, but isnt ideal), and also it is not the cleanest option.

Is there any more efficient approach? Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜