We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24935
    • 160 Posts
    Introducing ZoomMap 0.9 (the beta version)

    I found a cool jQuery interactive map (http://www.newmediacampaigns.com/page/a-jquery-plugin-for-zoomable-interactive-maps) and I created a MODx snippet for it, that does almost all of the work for you. Now you can make interactive maps just by adding documents to MODx!

    Setup:
    Upload zoommap.zip and unzip into the assets/snippets/ directory.

    Create a snippet:
    Snippet name: ZoomMap
    Description: <b>0.9</b> a jQuery interactive map
    Snippet code: copy and paste from snippet.txt

    Create a template for your data:
    It is probably easiest to just duplicate an existing template and put [!ZoomMap!] in the template where you want the map to appear.

    Create these template variables and assign them to the template:
    (Variable name / Caption / Input Type)
    zmX / X / Number
    zmY / Y / Number
    zmMap /Map / Image

    If you want to to zoom into a more detailed map, add these template variables:
    zmAreaWidth / Area Width / Number
    zmAreaHeight / Area Height / Number

    If you want to use different colored location margers, add another template variable
    zmBulletStyle / Bullet Style / Dropdown List Menu
    Input Option Values:
    Gold Star==||Red Star==redstar||Green Star==greenstar||Blue Star==bluestar

    Now create a page, and use the new template you created. Assign an image to the map tv.

    To create a location on the map, create a new page as a child of the main document. Add a title and some content, and assign some numbers to the x and y tvs.

    When you view the main map page, you should see a star appear at the location you specified. If you click on the star, a box will pop up with the title and content.

    If you want to zoom into a part of the map, add another document as a child of the main map. Assign a different image to the map tv, and give the x and y coordinates for the upper left corner of the clickable zone, and the width and height of the clickable zone.

    You can add as many points of interest as you like, and you can nest these maps as many levels deep as you want. This is the beta version, so please give feedback if you find any problems. There are a lot of parameters that you can use to config this snippet too, but I don’t have time to document them now.

    June 3: Updated zip file to fix problem with IE
      • 26931
      • 2,314 Posts
      cool - thanks for sharing! smiley
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        One thing... it’s been found to be not a good idea to leave extraneous .php files laying around in the snippets’ folders. The snippet.php file should have a filetype of .txt or even .tpl rather than .php to keep nasty people from trying to run the code directly. http://modxcms.com/forums/index.php/topic,30875.0.html
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 4310
          • 2,310 Posts
          Nice idea.
          Bookmarked for future use wink
            • 3749
            • 24,544 Posts
            Very cool. Thanks for contributing! grin
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 7231
              • 4,205 Posts
              SWEET!!! I can use this for sure...Thanks grin grin grin
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 14066
                • 37 Posts
                Nice! But...only in FF sad it doesn’t work in IE...Am I the only one with that problem?
                  • 16183
                  • 1,390 Posts
                  Brilliant work! thx for sharing..

                  cheers/k
                    • 26931
                    • 2,314 Posts
                    Nice! But...only in FF Sad it doesn’t work in IE...Am I the only one with that problem?
                    maybe try for once in your snippet code, line189 to delete the commata after

                    returnText: '{$returnText}',


                    ->

                    returnText: '{$returnText}'



                    like i said...not sure...could be smiley

                    *edit: ...after
                    data: '".$modx->makeUrl($id)."',
                    (line195) too?
                      • 24935
                      • 160 Posts
                      If you replace the snippet code with the code in the attached file, it should fix the problem (be sure to close and reopen your browser and/or clear your cache if it isn’t working).

                      This was a VERY quick release. I have not tested it on IE, IE6 may be a joy to get working, and I haven’t documented the parameters. It is likely I will add and adjust some of the features. I just wanted to get it out for testing and feedback.

                      If you do want it to work in IE6, you might try this parameter:
                      &bulletFormat=`gif`

                      I haven’t tried it yet myself, but I wrote code for it.