You are here

function recipe_page in Recipe 5

Menu Callback - created output for the main recipe page.

Return value

$body

1 string reference to 'recipe_page'
recipe_menu in ./recipe.module
Implementation of hook_menu().

File

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

Code

function recipe_page() {
  $body = "";
  if (arg(1) == "feed") {
    module_invoke('node', 'feed', module_invoke('taxonomy', 'select_nodes', recipe_get_recipe_terms(), 'or', 0, FALSE));
  }
  else {
    if (arg(1) != NULL) {
      $breadcrumb = drupal_get_breadcrumb();
      $term = recipe_build_breadcrumbs($breadcrumb);
      drupal_set_breadcrumb($breadcrumb);
      if ($term != NULL) {
        $content = recipe_index($term->tid);
        if ($content != '') {
          $body = theme('box', $term->name . '- ' . t('Sub Categories'), $content);
        }
        $terms = array_merge(array(
          $term->tid,
        ), array_map('_recipe_get_tid_from_term', module_invoke('taxonomy', 'get_children', $term->tid)));
        $body .= module_invoke('taxonomy', 'render_nodes', module_invoke('taxonomy', 'select_nodes', $terms));
      }
    }
    else {
      $body = '';
      if (variable_get('recipe_recent_box_enable', 1)) {
        $body = theme('box', variable_get('recipe_recent_box_title', t('Latest Recipes')), module_invoke('node', 'title_list', recipe_get_latest(variable_get('recipe_recent_display', '5')), '') . theme('recipe_more_info', theme('feed_icon', url("recipe/feed"))));
      }
      $content = recipe_index();
      if ($content != '') {
        $body .= theme('box', t('Recipe Categories'), $content);
      }
    }
  }
  return $body;
}