1

I've found a great clickable map over at code canyon which includes all the JavaScript, CSS, and XML to make it happen. A demo of the map can be viewed here.

I figure the best way to accomplish this would be to create a custom module and load the JavaScript, XML, and CSS files via the .info file.

The code to display the map is a simple html statement or two that could be placed on a basic page.

<div id="container">

    <div class="mapWrapper">
            <div id="map"></div>
            <div id="text"></div>
    </div>

</div>

Would it be better to create a page template specific to the node? How does one load the CSS and JavaScript from the module to the page?

2

You can use drupal_add_js() and drupal_add_css() in the menu call back function to add js and css files on the specific page.

Adding in the .info file would add js and css on all the pages.

You can also use hook_library() to define the library of js files and its dependancy with jquery or core js files.

  • Hitman Thank you for pointing me in the right direction. – David May 12 '12 at 7:04
2

If you want to add the map just to individual pages, drupal_add_js() and drupal_add_css() are your only friends. With them you will be able to hack the map into any node (eg. node--419.tpl.php) or any view (most probably views-view--VIEW-NAME.tpl.php). And then you'll get tempted to make it all into a module ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.