Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Load alternative default.master.tpl?

I'm trying to create a custom page that has a google map in it but I need to add a lot of javascript to the head. I don't want to have it loading in pages its not being used in so I'm not going to add it to the default.master.tpl. Is there a way to create another master - something like map.master.tpl where I can then load the javascript and customise the rest of the page?

Basically I want to these two pages - http://connormccarra.com/test/ and http://connormccarra.com/test/add - working inside the style of my forum (which is using the VanillaBootstrap theme). Any suggestions? I tried the plugins none of them seem to work very smoothly.

Comments

  • 422422 Developer MVP

    Use custom pages plugin, and set up routes.

    Check my air theme in my signature, and click on contact to see what i mean.

    422 Real Estate Australia , now open Check it out

    UnderDog
  • You could modify the add menu item plugin.

    and just selectively add the javascript to the pages you want based on the $Sender->SelfUrl

    it seems simple enough.

    But why don't you add the javascript in the test and test/add pages. and selectively add the links to the pages in the default.master.tpl


    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

    UnderDog
  • I starting messing about with the Custom Pages plugin and I have it setup exactly the way I wanted fairly easily. It takes awhile for you to get round how Custom Pages works. Problem was google maps normally use body onload(), got round it by using the below fix, with a few other changes:

     <script type="text/javascript"> 
      function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          if (oldonload) {
            oldonload();
          }
          func();
        }
      }
    }
    
    addLoadEvent(load);
    
    // arrange for our onunload handler to 'listen' for onunload events
    if (window.attachEvent) {
            window.attachEvent("onunload", function() {
                    GUnload();      // Internet Explorer
            });
    } else {
    
            window.addEventListener("unload", function() {
                    GUnload(); // Firefox and standard browsers
            }, false);
    
    }
      </script>
    

    You can see what I have done here: http://poultry.ie/plugin/page/breeders, I have yet to setup routes but all in good time :)

    422UnderDog
  • 422422 Developer MVP

    I like your add a breeder grab lat and long. Couldnt you use get location. Also validation on submit breeder needs fixing but looks cool. Good work

    422 Real Estate Australia , now open Check it out

    UnderDog
  • I don't feel get location is accurate enough yet. The way it is now allows the breeder to put the marker right up to their doorstep, so to speak which is very useful for directions.

Sign In or Register to comment.