GSAK (Geocaching Swiss Army Knife)
CustomFormat(sSection,[sOptions]) : string
You can generate your own custom HTML formats for SplitsScreen, Condensed print, View Offline, and File=>Export=>HTML.
To populate the drop down boxes with the custom formats you need to save a macro with a name starting with "HTML_" (without the quotes) in your GSAK "Macros" folder
The Customformat() function has been purpose built to help you easily generate these custom HTML pages which closely resemble the look and layout of the standard GSAK HTML display. You can of course generate your custom HTML pages from scratch, but using the CustomFormat() function will make it a lot easier for users with limited HTML knowledge and don't want to write a lot of macro code.
sSection = The section of HTML code to generate
sOptions = Optional. If no options are included then custom formats will respect the setting you have via Tools=>Options=>HTML. Any option you specify here will override the corresponding setting in the GUI options. All Gui options have a corresponding macro version that you can use to override the GUI setting. In addition there are a few extra options that are not available via the GUI
All options are in the form OptionName=Value. If a section supports multiple options each must be separated by a space.
All sections that show a title bar have the following options:
ShowTitle=Yes|No - allows you omit title bar if not required
TitleColor=#FFFFFF - change the title bar color
Other section specific options that correspond to the GUI options:
Header => Attributes=Yes|No ShowUtm=Yes|No
GoogleMap => MapHeight=nnn IconSet=n Mapserver=http://server
Custom data => Declutter=Yes|No
Logs => Decode=Yes|No Limit=nnn
Description => RemoveAdditional=Yes|No
Hints => Decode=Yes|No
OpenDoc Color=#FFFFFF (the body background color)
OpenTables Border=#FFFFFF (the border color)
OpenLeftCol Color=#FFFFFF (the left column background color)
OpenRightCol Color=#FFFFFF (the right column background color)
All custom formats should use the "OpenDoc" section . This opens the HTML document and sets up the required Java script and CSS required for other sections.
You should also use "OpenTables" so that sections are neatly placed in tables. If your format is to be displayed on a device that only has a small width screen (nettop for example) then use only OpenLeftCol. This will then place all your section is the one column, rather than having then split side by side.
To get an exact duplication of the standard "Full display" format that respects all your GUI settings, the custom format macro would be:
Now here is the same format but with a few option changes
Note the use of the NearBy section. This section shows the nearest (Max=) caches and is only applicable when doing "File=>Export=>HTML". If you omit the Max=nn option, then the value as per your export dialog is used.
The system variable $_HTMLFormat has also been included so you can take different action depending on where the code is to be used. This is handy where only minor differences are required to the code depending on where it is used:
SplitScreen - Split screen display
Export - File=>Export=>HTML
Offline - Right mouse click, "View offline in browser"
Condensed - File=>Print
The "Clean" section was not used in the above code but has been provided for low level use of database data in your custom HTML. When placing something like the cache name or placed by in the HTML you should never just use code like :
The reason being that the cache name could contain characters ("<", ">", "&", etc) that will mean your generated HTML code is invalid. Using "Clean" ensures that such data is correctly encoded. For example & is converted to &
This is automatically done when you use any of the other "sections" as given above. However, if you are generating your own data then you should be using the code like:
Note: The condensed print is a little different because the idea is to generate one print out for all the waypoints in your current filter.
All other HTML custom formats are for a single cache only and the whole resulting HTML code for each cache is returned in the system variable $_HTML
To cater for a single HTML file of all waypoints (condensed print), there are 3 system variables
$_HtmlHeader - The header part of the HTML, this will be output at the very start of the file, and only output once
$_HtmlBody - This is the output for each individual waypoint
$_HtmlFooter - The Footer part of the HTML, this will be output at the very end of the file, and only output once.
It doesn't matter what order you allocate values to these variables, but you must update each one with something somewhere in the custom macro. For a custom condensed format macro see the example at the
For example, the following custom format code will generated a summary of just the header information in two columns:
Alpha List Category List
Copyright 2004-2011 CWE Computer Services |