PDA

View Full Version : Multiple Pages/Maps in one directory


ztechinc282425
12-02-2009, 06:26 AM
I would like to setup 4-html pages in the same directory. Each to have their own unique map with a single point.

Since I know the GMP process stores everything in the google_javascript subdir it creates in the dir with the html page, how do I get the 4-pages to not overlay this code/directory?

Jason Byrnes
12-02-2009, 09:59 AM
Each page will have a unique js file created for it in the google_javascript directory.


For the first map, a file named wagmp_map_1.js will be created. The second map will create a file named wagmp_map_2.js for each map the number will increment.

ztechinc282425
12-03-2009, 02:38 PM
Each page will have a unique js file created for it in the google_javascript directory.


For the first map, a file named wagmp_map_1.js will be created. The second map will create a file named wagmp_map_2.js for each map the number will increment.

Great. Thanks. I guess I should have just tried it.

ztechinc282425
12-03-2009, 03:33 PM
Well, I did just try this and it doesn't work.

Every map after the first one, does not load.

After creating the second page with a new map, in the same directory, the google_javascript directory now has the _2 file and the wagmp_maps.js file is changed to:

window.onunload = function() {
GUnload();
}

/*wagmp_onload*/
if(window.wagmp_map_2) wagmp_map_2();
if(window.wagmp_map_1) wagmp_map_1();

The second page with a map does not load the map.

Go here for the first page that works:
http://noblewarriors.org/Events/Cracker_Barrel_Breakfast.htm

Then the second page, that does not work:
http://noblewarriors.org/Events/Cracker_Barrel_Breakfast_1208.htm

Yes, I triple-checked that the google_javascript directory has been uploaded/refreshed and I cleared my browser cache.

Great. Thanks. I guess I should have just tried it.

gruant2000381341
12-03-2009, 03:46 PM
I can see the map on both of those links...one 4 chester one for mech.

ztechinc282425
12-03-2009, 03:54 PM
Well, I figured out how to make it work, but you guys need to fix it.

I created a separate wagmp_maps_2.js file with a single entry for the _map file it needs:
if(window.wagmp_map_2) wagmp_map_2();

and changed the page to point to this "maps" file.

Now it works.

Well, I did just try this and it doesn't work.

Every map after the first one, does not load.

After creating the second page with a new map, in the same directory, the google_javascript directory now has the _2 file and the wagmp_maps.js file is changed to:

window.onunload = function() {
GUnload();
}

/*wagmp_onload*/
if(window.wagmp_map_2) wagmp_map_2();
if(window.wagmp_map_1) wagmp_map_1();

The second page with a map does not load the map.

Go here for the first page that works:
http://noblewarriors.org/Events/Cracker_Barrel_Breakfast.htm

Then the second page, that does not work:
http://noblewarriors.org/Events/Cracker_Barrel_Breakfast_1208.htm

Yes, I triple-checked that the google_javascript directory has been uploaded/refreshed and I cleared my browser cache.

ztechinc282425
12-03-2009, 03:54 PM
I just fixed it with my changes (see following post).

I can see the map on both of those links...one 4 chester one for mech.

Jason Byrnes
12-03-2009, 04:03 PM
That change may have worked, but is not necessary, there is something else going wrong.

I have created plenty of maps in the same site and had them work correctly, I can guarantee you that there is not a problem in tool that is causing this.


To get to the real cause of the problem, I would need to be able to see the issue in the browser.

ztechinc282425
12-04-2009, 06:10 AM
Well, we reworked all the pages by hand.

How is it supposed to work? Should the process create multiple "_maps" files that point to the individual "map_?" files?

Is there supposed to be multiple "if(window.wagmp_map_?) wagmp_map_?();" statements in the "_maps" file?

I am not a Javascript coder so I don't understand the language, but aren't these statements supposed to test if a file exists and then run/load it? If so, how does it know which one to load.

If needed, I can create a new set of files/maps in a different directory, since these pages have gone live (another helper modified the code to make it so that we don't have to have multiple pages - it just switches the map - a cool idea for the next release of GMP).

That change may have worked, but is not necessary, there is something else going wrong.

I have created plenty of maps in the same site and had them work correctly, I can guarantee you that there is not a problem in tool that is causing this.


To get to the real cause of the problem, I would need to be able to see the issue in the browser.

Jason Byrnes
12-04-2009, 09:35 AM
Pro maps will create one wagmp_maps.js file. this will have a line in it for each map that is created.

For each map that is created, it will create a wagmp_map_<int>.js file. <int> is a variable that will start at 1 and increment for each map you create.

On the page, to display the map, there will be a div created as the map place holder:
<div id="wagmp_map_<int>" style="width: 300px; height: 300px;"></div>


the id of the div "id="wagmp_map_<int>"" along with the JS include line:
<script type="text/javascript" src="google_javascript/wagmp_map_<int>.js">/*wagmp*/</script>

control which map is loaded.


The code in the wagmp_maps.js:
if(window.wagmp_map_<int>) wagmp_map_<int>();


is testing for the div ID on the page, and loading the corresponding map.