Introduction

This is a central location for users to share useful code samples for MapGuide, be they JavaScript?, .Net, PHP, Java, or something entirely new...

Code Samples

JavaScript

ASP.Net

.NET

PHP

Java

Fusion

Tiled Maps

Other

Creating New Pages

Page Title

When creating a new page, please use the following convention for the page location:

CodeSamples/TechnologyType/YourPageName

for example: CodeSamples/JavaScript/AJAXViewerEventHooking

This is to ensure that pages are easily found via the TitleIndex, and may allow for an automated index at some point.

You can easily do this by editing the the CodeSamples page, copying another entry, and then modifying it to fit your title. Once you have saved the page, you will have a handy link to follow to edit your own sample.

Header Section

Please include the following on every Code Sample page. It allows users to easily navigate the page, and if they come in off a search engine link they can get to the code samples index more easily.

[[PageOutline]]

This page is one of the !MapGuide Community CodeSamples.  Visit the CodeSamples page to view more!

Syntax Highlighting

Trac has some really cool syntax highlighting built into it. The MapGuide Trac doesn't have all of these set up, but at least the text/html one works, and does a reasonable job with both HTML and JS. For example:

<script type="text/javascript">

// Map loaded handler
function OnMapInitialized() {
    // Map has been initialized now we're off to the races.
    alert("Map has been initialized");
}
</script>

Please use this where possible to make your inline examples more readable.