Services Screencasts

Because its so much more fun to watch than to read!

Creating playlists (eg. xml files) on the fly

What is a playlist?

A "playlist" is a general term for set of files which are displayed together or in sequence by a Flash player. It could be a list of videos, MP3s, images, or a mix of these. Within SWF Tools they take the form of a general structured list of data that will eventually find its way into an XML file.

Displaying a list of files as a playlist

SWF Tools provides a useful function for generating playlist data: swftools_prepare_playlist_data(). This is really useful for quick results where you have a list of files and you just want to push them out. Once you have your playlist data, you can then pass it to a variation of the swf() function called swf_list().

// Generate some playlist data which is compatible with SWF Tools.
$playlist =  swftools_prepare_playlist_data(array('image1.jpg', 'image2.jpg'));

// Pass the playlist data to the playlist display function.
print swf_list($playlist);

// REMEMBER, that swf_list bahaves like swf(), so you can
// do all the same tricks with flashvars and params.
print swf_list($playlist, '400x300');

Menu items that are not links

Drupal's menu system lets you define an arbitrary number of menu items in a hierarchy, each of which is a link to somewhere in the site (or on another site). That's great, unless you want to have a menu tree that has items in it which are not, in fact, links. Several scenarios for this exist, including parent categories and section separators.

This page explains how to add "menu links" that will not actually link anywhere.

Modules

Modules that allow links that are not links:

Theme layer: Drupal 5

Alternatively, this can be accomplished in your theme:

Step 1

We will define the magic value <none> to mean "a path to nowhere", just like <front> means "the home page". The crucial part here is the theme_menu_item_link() function, which we will override. Place the following function in your template.php file.

<?php
function phptemplate_menu_item_link($item, $link_item) {
if ($item['path'] == '') {
$attributes['title'] = $link['description'];

How the system maintains menu order

Note: this page is highly technical and only needed if you want to change menu.inc itself.

We have seven integer columns each representing a piece of the materialized path (the path leading to the root), p1 .. p7 . This algorithm is Peter Wolanin's implementation of materialized path, heavily exploiting the fact that we know the max depth of the tree.

All the numbers you see here are menu link identifiers, a primary integer key for each menu link (in short: mlid). Note that for queries, the list of "parents" is derived from p1,p2,p3, not stored separately. mlid, plid are stored separately.

Materialized path mlid plid set of parents
5.0.0 5 0 0
5.6.0 6 5 5, 0
7.0.0 7 0 0
7.13.0 13 7 7. 0
7.15.0 15 7 7, 0
7.15.23 23 15 15, 7, 0
7.15.16 16 15 15, 7, 0
7.10.0 10 7 7, 0
7.10.22 23 15

SWF Tools: All things Flash

SWF Tools is a comprehensive API for common Flash-related tasks like:

  • Inserting SWF files on a page
  • Embedding flash in the page using common JavaScript scripts.
  • Playing a movie (FLV, MP4) or audio (MP3)
  • Playing a media playlist, using an XML file or generating dynamically.
  • Quickly generating playlists in common situations (eg. convert file attachments to a playlist).

The module supports a wide range of embedding methods and media players which are added by supporting modules included in the package, and it can produce standards-compliant code so that your website continues to validate.

The SWF Tools input filter lets Flash and media content be added easily to pages without exposing the PHP or full HTML input formats, but at the same time it allows the players to be customised and configured.

The API is designed to be accessible from PHP and from other modules so that they can take advantage of the embedding capabilities of SWF Tools without having to write your own code.

SWF Tools was originally written by Simon Hobbs (with some code ported from Flash Gallery and Flash Filter) and it was sponsored by emspace.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 6.x