You are here

function recipe_export in Recipe 5

Same name and namespace in other branches
  1. 6 recipe.module \recipe_export()
  2. 7.2 recipe.pages.inc \recipe_export()
  3. 7 recipe.module \recipe_export()

Menu callback; Generates various representation of a recipe page with all descendants and prints the requested representation to output.

The function delegates the generation of output to helper functions. The function name is derived by prepending 'recipe_export_' to the given output type. So, e.g., a type of 'html' results in a call to the function recipe_export_html().

Parameters

type:

  • a string encoding the type of output requested. The following types are currently supported in recipe module html: HTML (printer friendly output) recipeml: XML (RecipeML formatted output) Other types can be supported with contributed modules.

nid:

  • an integer representing the node id (nid) of the node to export
1 string reference to 'recipe_export'
recipe_menu in ./recipe.module
Implementation of hook_menu().

File

./recipe.module, line 849
recipe.module - share recipes for drupal 5.x

Code

function recipe_export($type = 'html', $nid = 0) {
  $type = drupal_strtolower($type);
  $export_function = 'recipe_export_' . $type;
  if (function_exists($export_function)) {
    echo call_user_func($export_function, $nid);
  }
  else {
    drupal_set_message(t('Unknown export format.'));
    drupal_not_found();
  }
}