Drupal 6 Template Suggestions

Template suggestions:

What's a template suggestion? It's an alternate template (.tpl.php) file that you have created to override the base or original template file. Suggestions only work when they are placed in the same directory as the base templates. In other words, if you want comment-blog.tpl.php to display in your browser, comment.tpl.php also needs to exist inside your theme and the two files must be in the same directory.

Theming OpenLayers

The following theming functions are available in the OpenLayers 2.x module:

Javascript

These themes are on the JS side.

Variable Styling Tutorial

This page describes how to do variable styling in OpenLayers 2.x module.

To actually create the styles, check out at http://drupal.org/node/620602

Attribute Replacement

The OpenLayers library allows you to use a specific syntax, ${variable_name}, to easily style a feature based on its attributes. The most direct use of this is with the OpenLayers Views Display plugin.

  1. Setup your Views Display according to Getting Started with OpenLayers.
  2. Add fields to your view that you want to use for styling (the 'attributes'). These attributes may be used as radius or color, or even icon URL later on.
  3. The values of these attributes are included in the OpenLayers Data view. This view produces in an Overlay layer that you can add to any preset.
  4. You need to reference each attribute by its machine-readable ID. Lookup the ID trough the Attributes and Styling information in the style options setings of the map data view. They have names like field_myfield_value.
  5. In the style associated with your preset, you can apply your attribute as a style like this:
    • pointRadius: ${field_radius_value}
    • fillColor: ${field_color_value}

API: Styles

OpenLayers styles definitions are a light wrapper around the functionality provided by styles in the OpenLayers javascript library. A simple style definition (one of the defaults included by the module) is

/**
 * Implements hook_openlayers_styles().
 */
function modulename_openlayers_styles() {
  $styles = array();
  $style = new stdClass();
  $style->api_version = 1;
  $style->name = 'default';
  $style->title = t('Default style');
  $style->description = t('Basic default style.');
  $style->data = array(
    'pointRadius' => 5,
    'fillColor' => '#FFCC66',
    'strokeColor' => '#FF9933',
    'strokeWidth' => 4,
    'fillOpacity' => 0.5
  );
  $styles[$style->name] = $style;
  return $styles;
}

The contents of $style->data are passed directly to the OpenLayers javascript, and therefore have documentation on OpenLayers.org.

Coded Styles

To provide custom styles in a module or feature, implement hook_openlayers_styles(), and return an array of styles, keyed by style name (like seen above).

Also, in order to tell CTools about your new hook, you will have to implement the following hook, like so:

<?php
/**

Starter Themes

A starter or "base" theme is one that typically has very little style and is designed to give you a head start building your own unique theme, usually using Drupal's subtheming.

This is a list of themes that currently identify themselves as starter themes. At time of writing some of these projects were in early alpha release or still in development. You will need to check the releases for each project.

Pages

Subscribe with RSS Subscribe to RSS - theming