Smarty Function Parameters

  • Smarty Function Developer Docs

    All features of the Google Maps API are not supported, we have selected functionality for the most common usage amongst our users. If the Google parameters you are looking for are not fully implemented or missing, you most likely need to edit the javascript templates and use the API directly.

    Most use cases will only need to use the required parameters, so the function will look something like this:
    {ujGoogleMaps_map module="myModule" name="map1" map=$item height="300"}
  • ujGoogleMaps_map (Commonly Used Features)

    Function
    ujGoogleMaps_map (Commonly Used Features)
    parameter
    type
    default
    required
    description
    width
    number
    100%/300px
    off
    Sets the width of the map on the inner div if the map is dynamic (default 100%), sets the height of the image generated for a static map (default is 300px with a max of 650px for static maps).
    static
    boolean
    false
    off
    Generates a static google map as a png image using Google Static Maps API. The height and width parameters are used for the image dimensions up to the Static API maximum of 650px x 650px. Note: You need to enable this api in your google webmaster account in order to see their statistics, to keep count of your API usage and avoid rate limiting. If you explicitly set static="false" the static map config setting will be overridden.
    image_mode
    boolean
    false
    off
    Uses the images from a module such as jrGallery rather than the item itself.
    template
    template
    display_map.tpl
    off
    Overrides the template used to display the map. The template must exist in the ujGoogleMaps/templates/ directory.
    marker
    mixed
    true
    off
    Set to false and no marker will be shown. Set to multiple when showing multiple markers or pass in an array of coordinates. Set to infowindow to show a popup info window when the marker is clicked.
    map_type
    string
    true
    off
    You can override the type of map displayed by using map_type="hybrid" (valid types are roadmap, terrain, satellite and hybrid), but you would most likely prefer to do this by limiting the user choice of map type in the module quota controls.
    controls
    boolean
    true
    off
    Set to false to hide the interactive map controls. More detailed control customisations can be found in the Developer Map Controls Docs
  • ujGoogleMaps_map (Required Params)

    Function
    string ujGoogleMaps_map (Required Params) (
    string name,
    string module,
    number height,
    array map
    )
    parameter
    type
    default
    required
    description
    name
    string
    -
    on
    Used in naming the map. The name should be unique for each usage of the function. The id and module are also used in naming the map for when the function is in an item_row.tpl or similar.
    module
    string
    -
    on
    Used in naming the map and for checking access permissions. "none" can be used as the value, but will only be needed for numeric coordinate maps.
    height
    number
    -
    on
    Sets the height of the map on the containing div if it is a dynamic map, sets the height of the image generated for a static map (max 650px for static maps).
    map
    array
    googlemaps
    on
    Required unless numeric coordinates are used. The item (or multiple items) to map. Generally this will mean passing in map=$item or map=$_items smarty variable in a module item template, eg /modules/jrBlog/item_detail.tpl for a single item, or /modules/jrBlog/item_list.tpl to show multiple blog posts on the same map. (see example)
    Very few parameters are actually required, but there are many. They have been split into separate tables but all of the parameters on this page are for the ujGoogleMaps_map smarty function.
  • ujGoogleMaps_map (Coordinate Parameters)

    Function
    ujGoogleMaps_map (Coordinate Parameters)
    parameter
    type
    default
    required
    description
    lat
    number
    -
    off
    Sets the latitude for the center of the map. Ignored if multiple markers are being displayed.
    lng
    number
    -
    off
    Sets the longitude for the center of the map. Ignored if multiple markers are being displayed.
    bounds_sw
    number
    -
    off
    Sets the bounds_sw bound of the map. Used to determine the viewport of the displayed map. Determined by the geocoded address for a single item, by the spread of markers if showing multiple items.
    bounds_ne
    number
    -
    off
    Sets the bounds_ne bound of the map. Used to determine the viewport of the displayed map. Determined by the geocoded address for a single item, by the spread of markers if showing multiple items.
    In addition to the above parameters, you can create the map center and bounds manually. No item or items (the map parameter) are needed.
  • ujGoogleMaps_map (Marker Parameters)

    Function
    string ujGoogleMaps_map (Marker Parameters) (
    mixed marker,
    template marker_template,
    image icon
    )
    parameter
    type
    default
    required
    description
    marker
    mixed
    true
    By default (true) a marker is show for each item passed into the ujGoogleMaps smarty function. Set to false and no markers will be shown. Set to multiple to show a marker for each of the items set in the items parameter. Pass in an array of items to show a specific set of markers. Set to infowindow to show a popup info window when the marker is clicked.
    marker_template
    template
    marker_template.tpl
    Overrides the template used to display the infoWindows on the map. The template must exist in the ujGoogleMaps/templates/ directory. Note that if image_mode="true", the default marker_template becomes marker_template_image_mode.tpl so use that template to base image maps on.
    icon
    image
    -
    Provide a marker icon filename, the image must be located in the ujGoogleMaps img directory. Here we are using 'pin.png', a marker image from http://thom.im/
    Set marker="infowindow" to show a popup info window when the marker is clicked. If you want the window to display something different to the defaults you can specify a custom template to use: marker_template="my_custom.tpl" which must be in the module directory.
  • Manually add multiple markers by passing an array of marker position data into the marker parameter like so:
    {$markers = []}
    {ujGoogleMaps_map module="ujBootstrap" height="400" name="doxy" lat="47.12402209999999" lng="-75.69911350000001" bounds_ne="(48,-74)" bounds_sw="(42.4253710802915, -77.69776451970847)" markers=$markers}
  • Map Controls & Interface

    The Maps API provides the following default controls:

    TABLE MISSING

    Additionally, keyboard handling is on by default on all devices.

    If you need to change the defaults you can add the following parameters. Alternatively you can edit the javascript directly in the appropriate js .tpl file in the ujGoogleMaps templates directory.
  • ujGoogleMaps_map (Map Controls Parameters)

    Function
    ujGoogleMaps_map (Map Controls Parameters)
    parameter
    type
    default
    required
    description
    controls
    boolean
    true
    off
    Set to false to hide the google map controls. Or specify the controls to show/hide like this: controls="panControl:false,zoomControl:true,scaleControl:true" panControl: boolean, zoomControl: boolean, scaleControl: boolean, mapTypeControl: boolean, streetViewControl: boolean, overviewMapControl: boolean
    map_type
    string
    roadmap
    Sets the visual type of map displayed to one of the following: roadmap, satellite, terrain, hybrid.
    map_type_control
    string
    empty
    Set to dropdown_menu to change the Map/Satellite/Terrain control.
    map_zoom_control
    string
    empty
    Set to small to use the mini zoom control
    map_tile
    number
    empty
    Shows an angled projection of the map. Set to 45 and set the map type to satellite for this to take effect.

Tags