Closed fabioaccetta closed 10 years ago
You have done it exactly as I do... there is no need to added to the POS_HEAD
but is perfect.
I thought is better to leave the developer to do it as you explained. A good concept to do a wiki.
:+1: great post, very helpful.
edit: @nigelterry provided a better, safer solution below. now to refactor 😝
As a variant, use appendJs() to insert whatever js you need within the scope that includes map.
For example to insert a block of js from a file, try: $leaflet->appendJs(file_get_contents('js/maptools.js'));
This saves making a global which is rarely a good idea.
Looking inside generated js code, I see that the "map" variable is local, inside a map_init() function, so I can't use it outside its scope.
Is there a plan to make this variable global, so can be used page-wide? Or must the developer implement something like this?
Inside a view:
Thanks. Regards.