Accessibility

Flex Article

 

Retrieving Drupal nodes with Flex 2


Table of Contents

Comments

Getting Drupal up and running

Before building your application, you'll need to install the Drupal content management system. As of Drupal Version 5.0, the installation process has been vastly simplified. An automated process has been added that installs the Drupal package, including the database. Follow the steps below to perform a base installation:

  1. Download the newest stable release of Drupal from http://www.drupal.org/download.
  2. Create a MySQL or PostgreSQL database for use with your Drupal install:

    mysql create database your_db_name

  3. Unpack the Drupal tarball in the HTML document root of your web server or another HTTP-accessible directory:

    On Unix: Unpack the archive using the command: tar -zxvf drupal-5.x.tar.gz

    On Windows: Unpack the archive using WinZip or WinRAR

  4. Modify permissions on the default settings.php file in your_drupal_install/sites/default/settings.php to allow the install script to modify it:

    On Unix: Use the command: chmod 777 your_drupal_install/sites/default/settings.php

    On Windows: Use the Windows command CACLS or XACLS, or use the Windows context-sensitive menu Properties (Security tab) to modify the permissions.

  5. Run the install script. To do so, navigate your browser to the base URL of your Drupal install. When browsing index.php in your Drupal install directory, you will see a "Database Configuration" page.

Once the installation is complete, the install will direct you to a "Welcome" page. Should you have trouble with your install, see the Drupal Troubleshooting FAQ. For Windows-specific installation guidelines, see Drupal's Windows-specific guidelines page. For further information regarding the installation of Drupal, see the Drupal Installation and configuration page.

Installing the required Drupal modules

Next, install the required Drupal modules, including AMFPHP, which is an RPC stack for PHP that enables Drupal to communicate with Flex.

  1. Download the latest stable release of the Drupal Services module from http://www.drupal.org/project/services.
  2. Download the newest stable release of the Drupal AMFPHP module at http://www.drupal.org/project/amfphp.
  3. Unpack the Services and AMFPHP tarballs in the modules directory of your Drupal install.
  4. Enable both the Services and AMFPHP modules within the Drupal administrator's interface at:

    http://your_drupal_install/admin/build/modules

  5. Make sure to also enable the AMFPHP server on the same page.
  6. For this example, I have disabled the "Use keys" and "Use sessid" options for the Services module. This is done in an effort to present the simplest possible example. To disable these options, do the following:

    1. Navigate your browser to http://your_drupal_install/admin/build/services/settings.
    2. Uncheck both the "Use keys" and "Use sessid" options.
    3. Click "Save configuration."

Installing AMFPHP

  1. Download the AMFPHP 1.9 Beta from http://www.5etdemi.com/uploads/amfphp-1.9.beta.zip.
  2. Unzip amfphp-1.9.beta.zip within the amfphp directory in your_drupal_install/modules/amfphp.
  3. Once step 2 is complete, test AFMPHP by navigating your browser to http://your_drupal_install/admin/build/services and clicking on the AMFPHP - /services/amfphp link under the "Services" heading.

    If AMFPHP is working properly, the output of that URL should look something like the following:

    amfphp and this gateway are installed correctly. You may now connect to this gateway from Flash.

    Note: If you're reading an old tutorial, it will tell you that you should see a download window instead of this message. This confused people so this is the new behaviour starting from amfphp 1.2.

    View the amfphp documentation

AMFPHP is now installed.

Note: For Flex to retrieve a node from your Drupal database, you must first create one. Make sure you create at least one story, page, or other node type to retrieve by clicking the "Create content" link in your Drupal administrator's interface, selecting a node type, and submitting it. Since it is the first node in the system, it will have a node ID of 1. If the node you decide to use has a different ID, adjust the MXML Application code accordingly. You will use this node later in this tutorial.