wert aus datenbank auslesen

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • Rouven
    Contao-Nutzer
    • 17.04.2013
    • 45

    #1

    wert aus datenbank auslesen

    hey,
    ich komme einfach nicht weiter und weiß nicht wo mein fehler ist. ich habe im katalog modul ein neues feld hinzugefügt "youtube" (steht auch so in der datenbank) nun möchte ich das feld in dem dazugehörigen template ausgeben mit:
    PHP-Code:
    <?php echo $image['data']['youtube']['value']; ?>
    aber ich erhalte keine ausgabe, hier ist der ganze code vom template

    PHP-Code:
    <?php if (count($this->entries)): ?>
    
    <?php global $ent; ?>
    
    <div class="layout_simple">
    
    
    <?php foreach ($this->entries as $entry): ?>
    <?php $entry = $this->entries[0]['data']; ?>
    
    
    <div class="grid_7 alpha item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
    <div class="text">
    <?php echo $entry['youtube']['value'].""; ?>
    <h2><?php echo $entry['title_de']['value']; ?></h2>
    
    <div style="text-align:justify;width:700px">
    {{iflng::de}}<?php echo $entry['description_de']['value']; ?>{{iflng}}
    {{iflng::en}}<?php echo $entry['description_en']['value']; ?>{{iflng}}
    </div>
    
    <!--
    <pre>
    <?php
    #print_r($this->entries[0]);
    ?>
    </pre>
    -->
    
    <?php if ($entry['showLink'] && $entry['link']): ?>
    <div class="link"><?php echo $entry['link']; ?></div>
    <?php endif; ?>
    <?php if ($entry['linkEdit']): ?>
    <div class="linkEdit"><?php echo $entry['linkEdit']; ?></div>
    <?php endif; ?>
    </div>
    </div>
    
    <?php endforeach; ?>
    </div>
    
    
    <div class="grid_3 omega">
    <?php if ($entry['mother']['value']) : ?>
      <h3>{{custom::mother}}</h3>
      <?php echo $entry['mother']['value']; ?> 
    <?php endif; if ($entry['father']['value']) : ?>
      <h3>{{custom::father}}</h3>
      <?php echo $entry['father']['value']; ?> 
    <?php endif; ?>
    </div>
    
    
    
    
    <div class="grid_10 alpha omega">
    
    
    <?php if (count($ent)): ?>
    <h3 class="text" style="margin:20px 10px;;text-align:center;font-size:14px;">{{custom::pictures_of_offspring}}</h3>
    <div class="clear"></div>
    <?php $i=0; foreach ($ent as $image): ?>
    
    <div class="childe grid_5 alpha">
    <h4>{{iflng::de}}<?php echo $image['data']['title_de']['value'] ?>{{iflng}}{{iflng::en}}<?php echo $image['data']['title_en']['value'] ?>{{iflng}}</h4>
    <div class="childe_img">
    {{iflng::de}}
      <a rel="lightbox[offspringcatalog]" href="<?php  echo $image['data']['image']['files'][0] ?>" title="<?php echo $image['data']['title_de']['value'] ?>"><img src="<?php echo $image['data']['image']['meta'][0]['src']; ?>" alt="<?php echo $image['data']['title_de']['value'] ?>" <?php echo $image['data']['image']['meta'][0]['wh']; ?>">
    {{iflng}}
    {{iflng::en}}
      <a rel="lightbox[offspringcatalog]" href="<?php  echo $image['data']['image']['files'][0] ?>" title="<?php echo $image['data']['title_en']['value'] ?>"><img src="<?php echo $image['data']['image']['meta'][0]['src']; ?>" alt="<?php echo $image['data']['title_en']['value'] ?>" <?php echo $image['data']['image']['meta'][0]['wh']; ?>">
    {{iflng}}
    <?php if ($image['data']['status']['value'] != 'Abzugeben') : ?>
      <span class="status"><?php echo $image['data']['status']['value'] ?></span>
    <?php endif; ?></a>
    </div>
    <div class="childe_text">
    <?php if($image['data']['gender']['value']): ?><p><strong>{{custom::gender}}:</strong> <?php echo $image['data']['gender']['value']; ?> </p>
    <?php endif; ?>
    <?php if($image['data']['ident_no']['value']): ?><p><strong>{{custom::ident_no}}:</strong> <?php echo $image['data']['ident_no']['value']; ?></p>
    <?php endif; ?>
    <?php if($image['data']['morph']['value']): ?><p><strong>Morph:</strong> <?php echo $image['data']['morph']['value']; ?></p>
    <?php endif; ?>
    <?php if($image['data']['price']['value']): ?><p><strong>{{custom::price}}:</strong> <?php echo $image['data']['price']['value']; ?></p>
    <?php endif; ?>
    <?php if($image['data']['date_of_hatch']['value']): ?><p><strong>{{custom::date_of_hatch}}:</strong> {{iflng::de}}<?php echo date('d.m.Y', $image['data']['date_of_hatch']['value']); ?>{{iflng}}{{iflng::en}}<?php echo date('Y-m-d', $image['data']['date_of_hatch']['value']); ?>{{iflng}}</p>
    <?php endif; ?>
    </div>
    </div>
    
    
    <?php echo $image['data']['youtube']['value'].""; ?>
    <h3 class="text" style="padding-left:110px;font-size:12px;float:left">Video</h3>
    <?php if ($image['data']['youtube']['value']): ?>
    <div class="field videos_vimeo_id">
          <iframe width="560" height="315" src="<?php echo $image['data']['youtube']['value']; ?>" frameborder="0" allowfullscreen></iframe>
    </div>
    <?php else: ?>
    <div style="padding-top:70px;text-align:center;position:absolute;width:240px;height:80px;border:1px solid #fff;margin-left:500px;margin-top:20px;">
        Kein Video verfügbar
    </div>
    <?php endif; ?>
    
    <div class="clear"></div>
    
    <?php endforeach; ?>
    
    
    
    
    <?php else: ?>
    
    <?php if ($this->condition): ?>
    <div class="condition"><?php echo $this->condition; ?></div>
    <?php else: ?>
    <p class="info">There are no entries matching your search.</p>
    <?php endif; ?>
    
    <?php endif; ?>
    
      
    </div>
    
    
    <div class="clear"></div>
    
    <?php else: ?>
    
    <?php if ($this->condition): ?>
    <div class="condition"><?php echo $this->condition; ?></div>
    <?php else: ?>
    <p class="info">There are no entries matching your search.</p>
    <?php endif; ?>
    
    <?php endif; ?>
    dabei sind die felder wie z.b. preis auch neu hinzugefügt worden - muss irgendwo im system noch was angeben? habe die ganzen dateien im modulverzeichnis "katalog" nach price durchsucht aber dort finde ich nichts im code.

    wäre euch echt super dankbar für hilfe
  • willshedo
    Gesperrt
    • 23.06.2009
    • 322

    #2
    Hi,


    die Frage gehört eigentlich ins 'Catalog'-Unterforum...

    um deine frage zu beantworten, wäre es hilfreich zu wissen, wie du das feld denn hinzugefügt hast.
    Was wird eingetragen, ein ganzer Link? Ein Dateiname?

    Wird überhaupt irgendwas ausgelesen, wenn du mit <?php $this->showTemplateVars(); ?> die Variablen anschaust?

    dabei sind die felder wie z.b. preis auch neu hinzugefügt worden - muss irgendwo im system noch was angeben? habe die ganzen dateien im modulverzeichnis "katalog" nach price durchsucht aber dort finde ich nichts im code.
    Die Dateien im Modulordner 'katalog' werden auch nicht verändert für nachträglich korrekt hinzugefügte Felder.
    Zuletzt geändert von willshedo; 26.04.2013, 12:59.

    Kommentar

    • Messa
      Alter Contao-Hase
      • 19.01.2011
      • 1423

      #3
      Lass im Template mit

      PHP-Code:
      <pre>
      <?php print_r($this->entries); ?>
      </pre>
      Alle Felder ausgeben. Dann Siehst du ob du es richtig gemacht hast.

      Dann sollte irgendwo in der Ausgabe so was stehen

      PHP-Code:
      [data] => Array
              (
                [youtube] => Array
                  (
                    [label] => Titel
                    [type] => text
                    [raw] => INHALT
                    [value] => INHALT
                  ) 
      
      Du kannst auch nur $this ausgeben lassen, dann siehst du alle Arrays.

      Lg Matthias
      Full Service Agentur - Grafikdesign, Screendesign, Webdesign, Webentwicklung, SEO, Weiterbildung, persönliches Coaching
      http://www.matthiasgmeiner.com

      Kommentar

      Lädt...