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

Recipe Modul Frage

Eingetragen von hasel (136)
am 20.07.2012 - 16: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 - 18: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 - 13: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

  • gepatchte PHP Version 7.4 für Windows
  • Canvas Palette: Eine fertige Komponentenbibliothek für Drupal Canvas
  • Hilfe zu Updates oder Composer
  • Vergleich Drupal und Contao
  • [geloest] Blocks in Bootstrap nebeneinander darstellen und nicht untereinander
  • DrupalCamp Frankfurt 27-28 November 2026
  • Bitte mein Bentzerkonto löschen
  • Beim Aufruf einiger Inhalte erhalte ich folgende Fehlermeldung
  • Neuinstallation: vermutlich ein rewrite-Problem
  • Drupal CMS installieren
  • [erledigt]MP3 in Drupal 10 einbinden
  • (gelöst)Drupal 11 installieren
Weiter

Neue Kommentare

  • Muss ja nicht genau php 8.3 sein
    vor 1 Woche 3 Tagen
  • Guten morgen und Danke
    vor 1 Woche 3 Tagen
  • Evtl. versuchen auf PHP 8 zu wechseln
    vor 1 Woche 3 Tagen
  • Danke Schmittrich. Die Frage
    vor 1 Woche 5 Tagen
  • Keine Antwort auf die Frage nach dem Woher
    vor 1 Woche 5 Tagen
  • Danke ich werde mir die
    vor 7 Wochen 3 Tagen
  • Vielen Dank für Ihren
    vor 7 Wochen 6 Tagen
  • Composer ist sehr ratsam
    vor 8 Wochen 23 Stunden
  • Vielen Dank für den
    vor 8 Wochen 3 Tagen
  • Die alten CMS Vergleiche von contentmanager.de
    vor 8 Wochen 3 Tagen

Statistik

Beiträge im Forum: 250323
Registrierte User: 20572

Neue User:

  • alxshell
  • AnthonyhoF
  • Philiphelve

» Alle User anzeigen

User nach Punkten sortiert:
wla9466
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 20 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