Services coding standards

This section seeks to detail standards for contributing code to the services project.

  • For all new service all method names should match the appropriate drupal function name - note current methods do not follow this pattern but will be patched in the near future

SWF Embed

SWF Embed is a simple developer-centered module for working with Macromedia Flash-based content. It provides the necessary hooks for adding Flash content on the server-side, as well as the necessary JavaScript and jQuery for working with the Flash on the client-side.

This handbook describes how the SWF Embed module can be used to add Flash files to your site.

Overview of the Module

The SWF Embed module has two parts: The server-side module and the client-side JavaScript libraries. Many tasks will require only light server-side programming, but more sophisticated applications may use the JavaScript libraries directly, too.

The swfembed.module File

The swfembed.module file houses the server-side code. Practically speaking, there are only two items in this file that you will need to know about:

  1. The SWFObject class.
  2. The swfembed_embed theme implementation.

The first describes the Flash file and its configuration. The second takes that description and renders it into the appropriate JSON data structure for transmission to the client.

The JavaScript Libraries

There are two JavaScript libraries included with the module:

  1. jquery.swfembed.js: A jQuery plugin that provides Flash support.

Add [Results x to y out of z] info to a view

I looked around a bit, but couldn't find a built-in way of producing:

[Results 20 to 30 of 64]

sort of header to my paged view.
So here's how I did it. Including the exploratory steps.

  1. Locate your view renderer and create a theme for it.
    In my case, I edited the view, and clicked 'theme info'.
    My view called "topiclist" was currently using "Display output: views-view.tpl.php".
    The views UI told me I could instead use "views-view--topiclist.tpl.php" so I copied views-view.tpl.php from the views module directory into my theme and renamed it as suggested. (and re-scanned directories using the provided button as advised)
    This is normal views theming. I now have control of that level of rendering.
  2. Figure out what you are working with
    That page had a lot of stuff I didn't recognize or think I needed, but I didn't remove anything. Instead I made sure devel.module was on and added
    dpm($variables);
    

    into that page for debugging.

  3. Display what you want
    That showed me everything available for messing around with. I figured the $view->pager was a useful place to start, and after a few tests produced the following code:
    <?php
    $start = ($view->pager['current_page'] * $view->pager['items_per_page']) + 1;
    $finish = $start + count($view->result) - 1;
    $total = $view->total_rows;

Configuring PHP to resolve the "Error sending email" message

This article is based on experience with a Linux system running an Apache web server, but the problems and solutions apply to many other Linux and non-Linux environments.

Navigate - a 3 minute whirlwind tour

On http://drupal.org/project/navigate, there is a quick, 3-minute whirlwind tour of the Navigate module, which uses tools like menu search and bookmarking to make navigating through Drupal as quick and effective as possible.

Pages

Subscribe with RSS Subscribe to RSS - Programmers