Jump to content

Pulling Through Fields From Selected Database in GlobalTemplate


Recommended Posts


We've got a database setup as well as having templates for that database working, and we're looking to include a Google Map on the record pages. The map's co-ordinates will be dynamic for each record listing, and will need to pull through the lat and lng from our database in order to achieve it.

This would be an easy task if the code we needed the fields on were in our database templates, however it's a piece of javascript that belongs in the GlobalTemplate file, so I can't just use the regular line that grabs a database field in the database templates, as the GlobalTemplate file doesn't know which database to grab from.

Is there an easy and quick way for us to pull through a database field from a specific database, for all records.


    function initialize() {
      var myLatlng = new google.maps.LatLng(-X-,-Y-)
      var myOptions = {
        zoom: 8,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    function loadScript() {
      var script = document.createElement("script");
      script.type = "text/javascript";
      script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";

    window.onload = loadScript;

Above is the JS that is in the GlobalTemplate, and the values I wish to be dynamic are the -X- and -Y-, which should pull through that information from our specific database.

I found a forum post on a similar question, but that one seemed overcomplicated and involved specifying recordIDs, something that we're not going to be using to key off.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...