Katalog alles auf einer Seite anzeigen

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • nada
    Contao-Nutzer
    • 24.02.2010
    • 61

    #16
    Kannst du denn andere Seiten als PDF ausgeben lassen?
    Ja

    Werde es vorerst mit CSS lösen.
    gruss nada

    Kommentar

    • tognit
      Contao-Fan
      • 28.06.2009
      • 480

      #17
      Hallo zusammen

      Hab zu dem Thema auch noch eine Frage.

      Sollte dieser Code die Kategorien nicht nur einmal ausgeben?
      PHP-Code:
      <?php if (count($this->entries)): ?>
      <?php $lastcat=''; ?>
      <table class="layout_simpletable" summary="Catalog Items" cellspacing="0" cellpadding="0">
      <tbody class="body<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
      <?php foreach ($this->entries as $entry): ?>
      <?php if ($lastcat!=$entry[data]['linklistneu_kat']['value']): ?>
      <?php $lastcat=$entry[data]['linklistneu_kat']['value']; ?>
      <tr class="linkkat" >
         <th class="field <?php echo $field; ?>" ><?php echo $entry[data]['linklistneu_kat']['value']; ?></th>
      </tr>
      <?php endif; ?>
      <tr class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>" >
      <?php foreach ($entry['data'] as $field=>$data): ?>
      <?php if ($field=='linklistneu_kat') continue; ?>
      <?php if (!in_array($field, array('catalog_name','parentJumpTo'))): ?>
           <td class="field <?php echo $field; ?>" ><?php echo $data['value']; ?></td>
      <?php endif; ?>
      <?php endforeach; ?>
      </tr>
      <?php endforeach; ?>
      </tbody>
      </table>
      
      <?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; ?>
      Leider zeigt er mir bei jeder Unterkategorie auch die Kategorie wieder an. Was habe ich in diesem Code falsch gemacht?

      Besten Dank für die Hilfe

      Gruss
      Steven

      Kommentar

      • xtra
        Maintainer
        • 02.07.2009
        • 2007

        #18
        Hi tognit,

        Das von dir zitierte Template ist fyr Kategorien in nur einer Ebene gedacht.
        Du willst jedoch Kategorien mit Unterkategorien realisieren.
        Hierbei musst du anders vorgehen.
        Du musst dir saemtliche vorherigen Kategorien merken und nur wenn eine "neue" erscheint, dieselbige ausgeben.
        Ungetestet aus dem Kopf sieht das in etwa so aus:
        PHP-Code:
        <?php if (count($this->entries)): ?>
        <?php $lastcats=array(); ?>
        <table class="layout_simpletable" summary="Catalog Items" cellspacing="0" cellpadding="0">
        <tbody class="body<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
        <?php foreach ($this->entries as $entry): ?>
        <?php if (!in_array($entry['data']['linklistneu_kat']['value'], $lastcats): ?>
        <?php $lastcats[]=$entry['data']['linklistneu_kat']['value']; ?>
        <tr class="linkkat" >
           <th class="field <?php echo $field; ?>" ><?php echo $entry['data']['linklistneu_kat']['value']; ?></th>
        </tr>
        <?php endif; ?>
        <tr class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>" >
        <?php foreach ($entry['data'] as $field=>$data): ?>
        <?php if (!in_array($field, array('catalog_name','parentJumpTo', 'linklistneu_kat'))): ?>
             <td class="field <?php echo $field; ?>" ><?php echo $data['value']; ?></td>
        <?php endif; ?>
        <?php endforeach; ?>
        </tr>
        <?php endforeach; ?>
        </tbody>
        </table>
        
        <?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; ?>
        Grysse
        X
        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

        • tognit
          Contao-Fan
          • 28.06.2009
          • 480

          #19
          Guten Morgen xtra

          Besten Dank für deinen Code. Es ist fast die Lösung

          Die Ausgabe der Kategorie erfolgt wie erwartet nur einmal. Doch leider wird nur eine Unterkategorie unterhalb der Kategorie angezeigt. Wenn man jetzt eine neue Unterkategorie anlegt, wird sie unter der letzten Kategorie angezeigt.

          Etwa so:
          Kat1
          -Kat1.1
          Kat2
          -Kat2.1

          -Kat1.2

          Besten Dank

          Gruss
          Steven

          Kommentar

          • tognit
            Contao-Fan
            • 28.06.2009
            • 480

            #20
            Hallo zusammen

            Stehe mal wieder vor diesem Problem.

            Wie kriege ich die Ausgabe so hin?
            Kat1
            -1.1
            -1.2
            Kat2
            -2.1
            Kat3
            -3.1
            -3.2

            Also wenn man einen neuen Eintrag macht, dass dieser in seiner Hauptkategorie erscheint.

            Gruss
            Steven

            Kommentar

            • tognit
              Contao-Fan
              • 28.06.2009
              • 480

              #21
              Habs gefunden in diesem Thema
              Katalogliste-mit-Accordion

              Code geändert ohne Akkordeon:
              PHP-Code:
              <?php if (count($this->entries)): ?>
              <?php
              $fieldName = 'activity_gruppe'; // field name for creating collections
              $arrCategories = array(); // collects all catalog entries
              $arrSorted = array(); // collects all sorted catalog entries
              $index = 0;
              foreach($this->entries as $entry)
              {
                  $act = $entry['data'][$fieldName]['value'];
                  
                  // check if category already exists / or not
                  if( array_key_exists($act, array_flip($arrCategories) ) )
                  {
                      $arrSorted[$act][] = $entry; // fill existing category node
                      $index++;
                  } 
                  else 
                  {
                      if( !strlen($act) ) // Incase entry has no categorie selected, build free category
                      {
                          $act = 'Ohne Kategorie';
                      }
                      
                      $arrSorted[$act][0] = $entry; // create new category node
                  }
                  $arrCategories[] = $entry['data'][$fieldName]['value'];
              }
              ?>
              <?php foreach($arrSorted as $k => $entries): ?>
               <div class="team_cat"><?php echo $k; ?></div>
               <?php foreach($entries as $entry): ?> 
               <div class="team_items <?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
                <div class="team_image"><?php echo $entry['data']['photo']['value']; ?></div>
                <div class="team_info"><?php echo $entry['data']['info']['value']; ?></div>
               </div>
               <?php endforeach; ?>
              <?php endforeach; ?>
              <?php endif; ?>
              Verbesserungen nehme ich gerne entgegen.

              Gruss
              Steven

              Kommentar

              Lädt...