Catalog_full.tpl - Hilfe ich finde den Fehler nicht

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • AgentK
    Contao-Fan
    • 20.06.2009
    • 420

    #1

    Catalog_full.tpl - Hilfe ich finde den Fehler nicht

    Hallo,

    ich habe mal eine Frage an die PHP Spezialisten unter Euch.

    Ich habe die catalog_full.tpl editiert und komme irgendwie nicht mehr weiter. Alle Einträge werden mir mehrfach ausgeworfen. Ich habe Änderungen am endif und/oder endforeach vorgenommen, als Ergebnis wurden mir dann immer gar keine Daten mehr ausgegeben. Vielleicht kann mir jemand einen Tipp geben, wo ich einen Fehler gemacht habe.

    PHP-Code:
    <?php if (count($this->entries)): ?>
    
    <div class="layout_full">
    
    <?php foreach ($this->entries as $entry): ?>
    <div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
    <?php foreach ($entry['data'] as $field=>$data): ?>
    <?php if (strlen($data['raw']) && !in_array($field, array('catalog_name','parentJumpTo'))): ?>
    <div class="field <?php echo $field; ?>">
    
    <div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
    <div class="content">
    <div class="name"><?php echo $entry['data']['name']['value']; ?></div>
    <div class="ansprechpartner"><?php echo $entry['data']['ansprechpartner']['label']; ?> <?php echo $entry['data']['ansprechpartner']['value']; ?></div>
    <div class="anschrift"><?php echo $entry['data']['anschrift']['value']; ?>, <?php echo $entry['data']['plz']['value'];?> <?php echo $entry['data']['ort']['value'];?> (<?php echo $entry['data']['region']['value'];?> ,<?php echo $entry['data']['land']['value'];?>)</div>
    <br />
    <br />
    <div class="telefon"><?php echo $entry['data']['tel_m_vorwahlen']['label']; ?> <?php echo $entry['data']['tel_m_vorwahlen']['value']; ?></div>
    <div class="fax"><?php echo $entry['data']['fax_m_vorwahlen']['label']; ?> <?php echo $entry['data']['fax_m_vorwahlen']['value']; ?></div>
    <div class="homepage"><?php echo $entry['data']['homepage']['label']; ?> <?php echo $entry['data']['homepage']['value']; ?></div>
    <div class="email"><?php echo $entry['data']['email']['label']; ?> <?php echo $entry['data']['email']['value']; ?></div>
    
    </div>
    </div>
    <?php endif; ?>
    <?php endforeach; ?>
    </div>
    <?php endforeach; ?>
    </div>
    
    <?php else: ?>
    <p class="info">Invalid item reference for catalog.</p>
    <?php endif; ?>
    Vielen Dank
    Stefan
  • jan.theofel
    Contao-Urgestein
    • 23.06.2009
    • 1857

    #2
    Hi,

    ganz einfach:

    PHP-Code:
    <?php foreach ($this->entries as $entry): ?>
    Diese Zeile loopt durch deine Treffer. Du brauchst sie.

    PHP-Code:
    <?php foreach ($entry['data'] as $field=>$data): ?>
    Die hier brauchst du nur, wenn du durch alle Felder loopen willst und pro Feld je ein Label/Value Paar ausgeben willst. Das brauchst du nicht, weil du ja jedes Feld manuell ansprichst. Wirf sie mit dem zugehörigen endforeach raus.

    Jan
    Jan Theofel
    Barcamp-Moderator für Corporate-Barcamps und öffentliche Barcamps

    Kommentar

    • AgentK
      Contao-Fan
      • 20.06.2009
      • 420

      #3
      Hallo Jan,

      irgendwie hänge ich immer noch.

      Ich habe jetzt folgendes geändert:



      Code:
      <?php if (count($this->entries)): ?> 
      
      <div class="layout_full"> 
      
      <?php foreach ($this->entries as $entry): ?> 
      <div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>"> 
      [COLOR="red"][B]Zeile gelöscht (<?php foreach ($entry['data'] as $field=>$data): ?>)[/B][/COLOR]
      <?php if (strlen($data['raw']) && !in_array($field, array('catalog_name','parentJumpTo'))): ?> 
      <div class="field <?php echo $field; ?>"> 
      
      <div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>"> 
      <div class="content"> 
      <div class="name"><?php echo $entry['data']['name']['value']; ?></div> 
      <div class="ansprechpartner"><?php echo $entry['data']['ansprechpartner']['label']; ?> <?php echo $entry['data']['ansprechpartner']['value']; ?></div> 
      <div class="anschrift"><?php echo $entry['data']['anschrift']['value']; ?>, <?php echo $entry['data']['plz']['value'];?> <?php echo $entry['data']['ort']['value'];?> (<?php echo $entry['data']['region']['value'];?> ,<?php echo $entry['data']['land']['value'];?>)</div> 
      <br /> 
      <br /> 
      <div class="telefon"><?php echo $entry['data']['tel_m_vorwahlen']['label']; ?> <?php echo $entry['data']['tel_m_vorwahlen']['value']; ?></div> 
      <div class="fax"><?php echo $entry['data']['fax_m_vorwahlen']['label']; ?> <?php echo $entry['data']['fax_m_vorwahlen']['value']; ?></div> 
      <div class="homepage"><?php echo $entry['data']['homepage']['label']; ?> <?php echo $entry['data']['homepage']['value']; ?></div> 
      <div class="email"><?php echo $entry['data']['email']['label']; ?> <?php echo $entry['data']['email']['value']; ?></div> 
      
      </div> 
      </div> 
      <?php endif; ?> 
      [B][COLOR="red"]Zeile gelöscht (<?php endforeach; ?> )[/COLOR][/B]
      </div> 
      <?php endforeach; ?> 
      </div> 
      
      <?php else: ?> 
      <p class="info">Invalid item reference for catalog.</p> 
      <?php endif; ?>
      Hättest Du nochmal einen Tipp für mich? Die Abwandlung des "simple-Template" habe ich ohne Fehler geschafft.

      Danke
      Stefan

      Kommentar

      • xtra
        Maintainer
        • 02.07.2009
        • 2007

        #4
        Code:
        <?php if (count($this->entries)): ?> 
        <div class="layout_full"> 
        <?php foreach ($this->entries as $entry): ?> 
        <div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>"> 
        <div class="content"> 
        <div class="name"><?php echo $entry['data']['name']['value']; ?></div> 
        <div class="ansprechpartner"><?php echo $entry['data']['ansprechpartner']['label']; ?> <?php echo $entry['data']['ansprechpartner']['value']; ?></div> 
        <div class="anschrift"><?php echo $entry['data']['anschrift']['value']; ?>, <?php echo $entry['data']['plz']['value'];?> <?php echo $entry['data']['ort']['value'];?> (<?php echo $entry['data']['region']['value'];?> ,<?php echo $entry['data']['land']['value'];?>)</div> 
        <br /> 
        <br /> 
        <div class="telefon"><?php echo $entry['data']['tel_m_vorwahlen']['label']; ?> <?php echo $entry['data']['tel_m_vorwahlen']['value']; ?></div> 
        <div class="fax"><?php echo $entry['data']['fax_m_vorwahlen']['label']; ?> <?php echo $entry['data']['fax_m_vorwahlen']['value']; ?></div> 
        <div class="homepage"><?php echo $entry['data']['homepage']['label']; ?> <?php echo $entry['data']['homepage']['value']; ?></div> 
        <div class="email"><?php echo $entry['data']['email']['label']; ?> <?php echo $entry['data']['email']['value']; ?></div> 
        </div> 
        </div> 
        </div> 
        <?php endforeach; ?> 
        </div> 
        <?php else: ?> 
        <p class="info">Invalid item reference for catalog.</p> 
        <?php endif; ?>
        Bedenke stets: Wenn Du ungenaue oder unzureichende Angaben machst, so koennte dies die Bearbeitung deiner Frage endlos verzoegern (oder sogar dazu fyhren, dass ich zu viel nachdenken muss und die Antwort vergesse!). Kein Support per PN.

        Kommentar

        • AgentK
          Contao-Fan
          • 20.06.2009
          • 420

          #5
          Danke Xtra für die Hilfe.

          Ich habe noch eine Frage.

          Könnte es sein, dass der Catalog Probleme macht, wenn mann

          Code:
          <div class="agenturlogo">  
          <?php if($entry['data']['logo']['value']):?><?php echo $entry['data']['logo']['label']; ?><div class="logo"><?php echo $entry['data']['logo']['value']; ?></div><?php endif;?></div>
          oder die einfache Variante

          Code:
          <div class="anschrift"><?php echo $entry['data']['anschrift']['value']; ?></div>
          verwendet und kein Bild in der Datenbank verlinkt ist.

          Ich bekomme dann immer den Link "Die Details des Eintrags ansehen" angezeigt. Dieser wird bei mir in der Detailseite angezeigt und ist somit falsch.

          Gruß
          Stefan

          Kommentar

          • MacKP
            Contao-Yoda
            • 15.06.2009
            • 13315

            #6
            Hallo AgentK,
            das Problem ist mir bisher noch unbekannt.
            Sollte auch so nicht sein.

            Kannst du uns mal ne Ausgabe von:
            <?php print_r($this->entries); ?>
            geben?

            Viele Grüße
            Contao Pool | C-C-A | MetaModels | [Internetseite -> Mediendepot Ruhr]
            [Arbeitet bei -> Paus Design & Medien]
            "I can EXPLAIN it to you, but I can't UNDERSTAND it for you."

            Kommentar

            • AgentK
              Contao-Fan
              • 20.06.2009
              • 420

              #7
              Hallo,

              ich habe mal Demodaten verwendet.

              Array ( [0] => Array ( [id] => 88 [catalog_name] => Kleindarsteller Agenturen [parentJumpTo] => 0 [tablename] => kleindarsteller_agenturen [showLink] => [class] => first last even [data] => Array ( [name] => Array ( [label] => Name [type] => text [raw] => 030 Demo [value] => 030 Demo ) [ansprechpartner] => Array ( [label] => Ansprechpartner(in): [type] => text [raw] => Frau Demo [value] => Frau Demo ) [anschrift] => Array ( [label] => Anschrift [type] => text [raw] => Demostraße 123 [value] => Demostraße 123 ) [plz] => Array ( [label] => PLZ [type] => text [raw] => 00000 [value] => 00000 ) [ort] => Array ( [label] => Ort [type] => text [raw] => Demostadt [value] => Demostadt ) [produktion_name] => Array ( [label] => Produktionsname [type] => text [raw] => [value] => ) [region] => Array ( [label] => Region [type] => select [raw] => 2 [value] => Berlin [ref] => Array ( [0] => Array ( [id] => 2 [pid] => 67 [tstamp] => 1277667347 [sorting] => 512 [type] => [alias] => berlin [name] => Berlin ) ) ) [tel_m_vorwahlen] => Array ( [label] => Telefon: [type] => text [raw] => +00 (0)00 - 0000 00 00 [value] => +00 (0)00 - 0000 00 00 ) [fax_m_vorwahlen] => Array ( [label] => Fax: [type] => text [raw] => +00 (0)00 - 0000 00 00 [value] => +00 (0)00 - 0000 00 00 ) [email] => Array ( [label] => E-Mail: [type] => url [raw] => dummy@example.com [value] => dummy@example.com ) [homepage] => Array ( [label] => Homepage [type] => url [raw] => http://www.google.de [value] => www.google.de ) [ueber_uns] => Array ( [label] => Über unser Schauspielagentur [type] => longtext [raw] => [value] => ) [logo] => Array ( [label] => Logo der Schauspielagentur [type] => file [raw] => [value] => Die Details des Eintrags ansehen [files] => Array ( ) [meta] => Array ( ) ) [staat] => Array ( [label] => Staat [type] => select [raw] => 67 [value] => Deutschland [ref] => Array ( [0] => Array ( [id] => 67 [pid] => 66 [tstamp] => 1276810575 [sorting] => 128 [type] => [alias] => deutschland [name] => Deutschland ) ) ) ) ) )
              030 Demo
              Ansprechpartner(in): Frau Demo
              Demostraße 123
              00000 Demostadt ( Berlin ,)

              Telefon: +00 (0)00 - 0000 00 00
              Fax: +00 (0)00 - 0000 00 00
              www.google.de
              dummy@example.com


              Gruß
              Stefan

              Kommentar

              • MacKP
                Contao-Yoda
                • 15.06.2009
                • 13315

                #8
                Hallo AgentK,
                kannst du uns mehr zu deiner Felddefinition sagen?
                Wie hast du das eingestellt?

                Code:
                [logo] => Array ( [label] => Logo der Schauspielagentur [type] => file [raw] => [value] => Die Details des Eintrags ansehen [files] => Array ( ) [meta] => Array ( ) )
                Und: wie sieht das aus, wenn ein Bild eingestellt ist?

                Viele Grüße

                PS: könntest du das beim nächsten mal vorformatiert aus dem Quelltext kopieren und in Code? Dann kann man da mehr erkennen...
                Contao Pool | C-C-A | MetaModels | [Internetseite -> Mediendepot Ruhr]
                [Arbeitet bei -> Paus Design & Medien]
                "I can EXPLAIN it to you, but I can't UNDERSTAND it for you."

                Kommentar

                • AgentK
                  Contao-Fan
                  • 20.06.2009
                  • 420

                  #9
                  Hallo,

                  okay beim nächsten Mal mache ich wieder Code draus.

                  Die Einstellungen für dieses Feld sind:

                  Spaltenname: Logo
                  Typ: Datei

                  Beschriftungsgruppe beginnen (aktiviert)
                  Theaterlogo

                  Als Bildfeld mit Miniaturansicht erstellt (aktiviert)

                  Bildbreite und -höhe: 200 * 100

                  Link als Dateidownload oder Bilder-Lightbox erstellen. (aktiviert)

                  Gruß
                  Stefan

                  Kommentar

                  • MacKP
                    Contao-Yoda
                    • 15.06.2009
                    • 13315

                    #10
                    Hallo AgentK,
                    war das Feld vorher mal ein anderer Feldtyp? Teste durchaus mal mit einem komplett neuen Feld was du anlegst dafür.
                    Und auch mit einem neuen Item.
                    Wie sieht die Ausgabe denn genau asu wenn ein Bild angegeben ist?

                    Viele Grüße
                    Contao Pool | C-C-A | MetaModels | [Internetseite -> Mediendepot Ruhr]
                    [Arbeitet bei -> Paus Design & Medien]
                    "I can EXPLAIN it to you, but I can't UNDERSTAND it for you."

                    Kommentar

                    • AgentK
                      Contao-Fan
                      • 20.06.2009
                      • 420

                      #11
                      Hallo,

                      eventuell habe ich jetzt den Fehler gefunden. Ich habe mehrere Kataloge angelegt und im jeweiligen Katalog sind namentlich die gleichen Felder enthalten.

                      Hierbei war es das Feld "Logo".

                      Als ich das Feld neu angelegt habe und wieder mit Logo bezeichnet hatte, habe ich den gleichen Fehler wieder erhalten. Als ich nun versucht habe, den Namen zu ändern ist der Link zu den Details verschwunden.

                      Kann es sein, dass das Feld "File" irgendwie durcheinander gekommen ist bzw. sich dahinter ein kleiner Bug versteckt?

                      Gruß
                      Stefan

                      Kommentar

                      • lindesbs
                        AG CMS-Garden
                        Contao-Urgestein
                        • 05.06.2009
                        • 4157

                        #12
                        Ich habe zur TemplateErstellung mal ein kleines Tool geschrieben : http://dev.typolight-forge.org/wiki/...plategenerator

                        Damit lassen sich diese statischen Templates relativ einfach generieren.

                        Dann hats der Fehlerteufel schwerer ;-)
                        von Willi Voltz aus PR 500: Henry George sagte einmal: »Kultur ist Zusammenarbeit.«


                        Contao-Hosting: begeisterter Uberspace-Nutzer

                        Kommentar

                        • jan.theofel
                          Contao-Urgestein
                          • 23.06.2009
                          • 1857

                          #13
                          Hi,

                          coole Sache. Gibt es das auch schon im Repository oder muss ich das manuell installieren? Ich muss nämlich heute noch ein Template zusammenschrauben. :-)

                          Jan
                          Jan Theofel
                          Barcamp-Moderator für Corporate-Barcamps und öffentliche Barcamps

                          Kommentar

                          • lindesbs
                            AG CMS-Garden
                            Contao-Urgestein
                            • 05.06.2009
                            • 4157

                            #14
                            Noch nicht im ER. Bisher nur im SVN oder als Paket downloadbar.
                            Werd ich am WE ins ER bringen, ich muss noc ein paar Uebersetzungen machen, und evt. SourceAnpassungen.
                            Teile deine Wuensche mit, ist ja eigentlich auch nur ein DesignerTool, damit man statische Template generieren kann.
                            von Willi Voltz aus PR 500: Henry George sagte einmal: »Kultur ist Zusammenarbeit.«


                            Contao-Hosting: begeisterter Uberspace-Nutzer

                            Kommentar

                            • AgentK
                              Contao-Fan
                              • 20.06.2009
                              • 420

                              #15
                              Na da freue ich mich schon riesig darauf, dann wird die Erstellung der Templates ein wenig einfacher als bisher.

                              Vielen Dank
                              Stefan

                              Kommentar

                              Lädt...