Creating a Drupal node template for Flash

Moving back to Drupal, our next task is to take our compiled Recipe Flash application and integrate it into our Drupal system. We will start out by doing the same thing we did in the previous chapters, and add our Flash application to our Drupal web site using the FlashNode module. We can do this by simply going to Create Content Flash, and then selecting our new SWF file where it asks for the Flash file. We can then click on the Save button to submit this Flash application to our Drupal...

Adding our custom media player to Drupal

The first step we will need to take is to change our nodeid variable back to the FlashVars format so that we can compile our new media player for Drupal. var baseURL String http localhost drupal6 var gateway String baseURL + services amfphp var sessionId String var nodeId Number root.loaderInfo.parameters.node After we run our media player with these changes (which compiles the SWF file), we can follow the steps from Chapter 4 and upload our new media player by navigating to Create Content...

Info

When we are finished walking through the steps above for the Instructions field, we should then have the following fields within our Recipe content type We should now have a Recipe content type that has all the necessary elements for any user to accurately submit a new recipe to our web site. So, let's go ahead and test this out by going to Create Content Recipe. Although, you will see the Instructions and Ingredients fields in the recipe form, you will most likely also notice that the Body...

Installing the Image Field module

In order to successfully install the ImageField module, we will also need to install the modules that the ImageField module is dependent on. Because of this, we will first need to install a total of three modules in order to use the ImageField module. These modules are as follows FileField ImageField Once we place these three modules in our site's modules folder, we can navigate to Administer Modules, where we should see the following Defines a file field type, mt . Depends Oft Content enabled...

Using the Content Template module Contemplate

The Content Template module Contemplate for short is a wonderful module that will allow us to create a template for any content type in our system. A template is simply a way to tell the system how to display each content type when it is viewed by each visitor, and we can use this to tell Drupal to show our new Recipe Flash application when anyone views a Recipe node. To begin, we will first need to download and install this module by going to http www.drupal.org project contemplate. Once we...

Installing a media player

There are several media players available to show video and audio content on our web site. Although each one of these players has their differences, all of them are fundamentally the same in how they play media on the site they are loaded. Following are the most popular media players that can be used with the jQuery Media module to show videos Dash Media Player JW FLV Player jw-flv-player Flow Player http www.flowplayer.org All of these players are great, so I suggest you read up on all of them...

Adding some status text

Now that we have a login button, our last element that we will need for our login block is a status text box that will tell the user if an error occurred. This can be done pretty easily by creating a new layer in their timeline called status. Now that we have our own status layer, we will create a new dynamic text field within this layer, with an instance name of status. Enter your username and password to login. We should now have a set of Flash objects that resemble a user login block. To...

How to use the API key

We can see firsthand how the API key works by clicking on the Browse link of the Services Administrator, where it lists all of the services available to external applications. Since not all service calls require an API key, we will need to select a service that performs data critical operations on our Drupal data in order to see what the API key does and what is required to implement this security check. We can see this key by selecting the same service that we did in the previous chapter by...

Adding the API key to our Drupal Service

Since the API key is only required for the services where data manipulation is required, we will need to structure our DrupalService class to either use the API key for some service calls, while at the same time, only use the session ID for others. Because of this, we will need to create our very own serviceCall method within our DrupalService that will handle these custom arguments depending on which service is called. Also, because the declaration of the call method, within the Netconnection...

The Drupal Service class

In all the previous chapters we interfaced with Drupal using the simple Netconnection call method. With each of these calls to our Drupal system, the API key was not required, and consequently, it was not necessary to build a separate class for interacting with our Drupal web site from a remote location. However, now, we have a special need to make certain service calls that require an added security measure, which should be encapsulated within its own class. Because of this, we will use this...

Installing the getID library

The getID3 library is a very useful PHP library that will automatically extract audio information called ID3 from any given audio track. We can install this useful utility by going to which is the getID3 library URL at SourceForge.net. Once we have done this, we should see the following We can download this library by clicking on the Download link on the first row, which is the main release. This will then take us to a new page, where we can download the ZIP package for the latest release. We...

Adding arguments to the service call

Our next task will be to determine which methods require an API key and which do not. This can be done using a simple function within our DrupalService class that will let us know if the API key is required given the service command. Although there are several functions that require an API key, we will only include the ones that we will use in our application. This function will look as follows Determines if we should use an API Key. private function usesKey command String Boolean switch...

Building a node editor in Flash

Before we can create our business logic for adding content to our Drupal installation, we will construct our node editor that we will use to view, edit, and add new content to our Drupal web site. Our goal here is to make this editor as easy to use as possible and make it obvious which operation we are performing viewing, adding, or editing . We can achieve this goal by creating an editor that resembles Drupal's node editor, where there are tabs at the top of the content that allow us to...