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

  • [Gelöst] Menü wie hier samsung.com/de/ wie, mit Drupal?
  • Wie erlaubt man neuen Benutzern auf die Resetseite zugreifen zu dürfen.
  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
  • [gelöst] Anzeigeformat Text mit Bild in einem Artikel, Drupal 11
  • Social Media Buttons um Insteragram erweitern
  • Nach Installation der neuesten D10-Version kein Zugriff auf Website
  • Composer nach Umzug
  • [gelöst] Taxonomie Begriffe zeigt nicht alle Nodes an
  • Drupal 11 + Experience Builder (Canvas) + Layout Builder
  • Welche KI verwendet ihr?
Weiter

Neue Kommentare

  • Казино с минимальным депозитом
    vor 6 Stunden 34 Minuten
  • Казино с минимальным депозитом
    vor 6 Stunden 35 Minuten
  • Казино с минимальным депозитом
    vor 6 Stunden 36 Minuten
  • Казино с минимальным депозитом
    vor 6 Stunden 38 Minuten
  • Казино с минимальным депозитом
    vor 6 Stunden 39 Minuten
  • melde mich mal wieder, da ich
    vor 2 Wochen 4 Tagen
  • Hey danke
    vor 2 Wochen 5 Tagen
  • Update: jetzt gibt's ein
    vor 2 Wochen 6 Tagen
  • Hallo, im Prinzip habe ich
    vor 3 Wochen 3 Tagen
  • Da scheint die Terminologie
    vor 3 Wochen 3 Tagen

Statistik

Beiträge im Forum: 250238
Registrierte User: 20457

Neue User:

  • Znogsnernoimb
  • ByteScrapers
  • Mroppoofpaync

» Alle User anzeigen

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