views:

19

answers:

1

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 (which doesnt really matter, but isnt ideal), and also it is not the cleanest option.

Is there any more efficient approach? Thanks

A: 

I don't see any other way to do this. I do it the same way too.

Argiropoulos Stavros