Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › Forum › Drupalcenter.de › Module ›

Recipe Modul Frage

Eingetragen von hasel (136)
am 20.07.2012 - 17:57 Uhr in
  • Module
  • Drupal 7.x

Hallo,

ich habe eine Frage und zwar gibt es bei dem Recipe Modul 2 Felder "recipe_preptime" und "recipe_cooktime" ich möchte diese beiden Felder addieren so das ich die Gesamtzeit herausbekomme. Ich weiß nur nicht genau wo ich ansetzen soll. ich habe in der Modul datei eine stelle gefunden wo das schon addiert wird. Ich brauche das nur extra als view Ausgabe.

/**
* Default theme implementation for the recipe summary box.
*/
function theme_recipe_summary($variables) {

  $node = $variables['node'];
  $show_title = isset($variables['show_title']) ? $variables['show_title'] : FALSE;
  $show_yield_form = isset($variables['show_yield_form']) ? $variables['show_yield_form'] : TRUE;
  // Construct the summary
  $output = '<div class="recipe-summary">';

  if ( $show_title ) {
    $output .= '<h2 class="title">' . t('Summary') . '</h2>';
  }

  $output .= '<table>';

  // Render the yield form.
  $yield_form = drupal_get_form('recipe_yield_form', $node, $show_yield_form);
  $output .= '<tr><th class="summary-title">' . t('Yield') . '</th><td class="summary-data">' . drupal_render($yield_form) . '</td></tr>';

  if ($node->recipe_source) {
    $output .= '<tr><th>' . t('Source') . '</th><td>' . $node->recipe_source . '</td></tr>';
  }
  if (isset($node->recipe_preptime)) {
    $_o_minutes = $node->recipe_preptime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }
   

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_preptime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_preptime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Prep time') . '</th><td>' . $_text . '</td></tr>';
  }

  if (isset($node->recipe_cooktime)) {
    $_o_minutes = $node->recipe_cooktime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_cooktime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_cooktime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Cooking time') . '</th><td>' . $_text . '</td></tr>';
  }

  if (isset($node->recipe_cooktime) && isset($node->recipe_preptime)) {
    $_o_minutes = $node->recipe_cooktime + $node->recipe_preptime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_totaltime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_totaltime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Total time') . '</th><td>' . $_text . '</td></tr>';
  }

  $output .= '</table>';
  $output .= '</div><div class="shadow-right"></div>';

  return $output;
}

ich weiß nur nicht wie ich das jetzt in ein extra feld eingeben muss.

Kann mir da jemand weiterhelfen, mir vielleicht einen Ansatz zeigen.

Liebe Grüße
André

‹ Meta Descriptions lassen sich für einzelne Seiten nicht ändern. Suche in nur einem Buch ermöglichen ›
  • Anmelden oder Registrieren um Kommentare zu schreiben

sorry ich bin es

Eingetragen von hasel (136)
am 23.07.2012 - 19:03 Uhr

sorry ich bin es nochmal,

hoffe ich habe meine Frage richtig formuliert. Hat da jemand von euch einen Ansatzpunkt für mich da happerts irgendwie bei mir.

lg
André

  • Anmelden oder Registrieren um Kommentare zu schreiben

ich bins noch mal, ich habe

Eingetragen von hasel (136)
am 25.07.2012 - 14:33 Uhr

ich bins noch mal,

ich habe jetzt das Modul "views global php" installiert da kann ich den passenden Code eingeben.

Nur haperts noch am Code. Kann mir keiner einen kleinen Tipp geben wo ich ansetzen muss bin echt schon am verzweifeln :-(

lg
hasel

  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • Drupal CMS installieren
  • [erledigt]MP3 in Drupal 10 einbinden
  • (gelöst)Drupal 11 installieren
  • Titel ausblenden
  • Ich brauche dringen Hilfe zu Updates oder ggf. wwie geht Composer?
  • Dynamische Ansicht von Seiteninhalt (als Tabelle?)
  • Vergabe von Berechtigungen für bestimmte Rollen; mir fehlt der Haken bzw. das „Veröffentlicht“
  • Medien und andere Daten mit Feeds von Drupal 7 auf Drupal 10 migrieren
  • Rolle erstellen nicht zu finden
  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
Weiter

Neue Kommentare

  • Verwende doch das Tag dafür,
    vor 2 Wochen 5 Tagen
  • Guckst du hier: step by step
    vor 2 Wochen 4 Tagen
  • Guckst du hier: step by step
    vor 2 Wochen 4 Tagen
  • Ich habe ja keine Angst vor
    vor 4 Wochen 3 Stunden
  • Ist grundsätzlichmachbar – aber nichts für „einfach mal schnell“
    vor 4 Wochen 2 Tagen
  • Vielen Dank erst einmal, aber
    vor 4 Wochen 4 Tagen
  • Du hast die "Trusted host
    vor 4 Wochen 4 Tagen
  • Bitte genauer den aktuellen Lösungs-Ansatz beschreiben
    vor 6 Wochen 3 Tagen
  • Git und rsync sind die wichtigsten Werkzeuge
    vor 6 Wochen 6 Tagen
  • Arrrrg. Nix Tabelle :-D /*
    vor 11 Wochen 2 Tagen

Statistik

Beiträge im Forum: 250284
Registrierte User: 20508

Neue User:

  • Marvinkep
  • RandallFloop
  • Inga GuAph

» Alle User anzeigen

User nach Punkten sortiert:
wla9464
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 12 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association