Accordion manuell in Template einbinden?

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

    #1

    Accordion manuell in Template einbinden?

    Hallo,

    könnt ihr mir einen Tipp geben, wie ich in ein Template des Catalog-List Moduls ein Accordion einbauen kann. Die Accordion-Funktion im Template Generator hat mir leider nicht weitergeholfen.

    Ich wollte es so aussehen lassen:

    < Accordion Titel 1 >

    Inhalte die durch das Template 1 abgefragt werden.

    < Ende Accordion 1>

    < Accordion Titel 2>

    Inhalte die durch das Template 2 abgefragt werden

    < Ende Accordion 2 >


    Vielen Dank für eure Hilfe!

    Gruß Stefan


    Template 1
    ==========
    Code:
    <!-- autogenerated source for template : Schauspieler - xxx -->
    <!-- Date : 2011-06-12 18:36 -->
    
    
    <?php if (count($this->entries)): ?>
    
    <div class="layout_full">
    
    
    <?php foreach ($this->entries as $entry): ?>
    <div class="item">
    
    
    
    
    <div class="field theater_jahr">
    	<div class="label"><?php echo $entry['data']['theater_jahr']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['theater_jahr']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field theater_stueck">
    	<div class="label"><?php echo $entry['data']['theater_stueck']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['theater_stueck']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field theater_name">
    	<div class="label"><?php echo $entry['data']['theater_name']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['theater_name']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field theater_regie">
    	<div class="label"><?php echo $entry['data']['theater_regie']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['theater_regie']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field theater_rolle">
    	<div class="label"><?php echo $entry['data']['theater_rolle']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['theater_rolle']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    
    <?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>
    
    <?php endforeach;?>
    
    </div>
    
    
    <?php else: ?>
    <p class="info">Invalid item reference for catalog.</p>
    <?php endif; ?>

    Template 2
    ==========
    Code:
    <!-- autogenerated source for template : Schauspieler - xxx -->
    <!-- Date : 2011-06-12 18:36 -->
    
    
    <?php if (count($this->entries)): ?>
    
    <div class="layout_full">
    
    
    <?php foreach ($this->entries as $entry): ?>
    <div class="item">
    
    
    
    
    <div class="field film_jahr">
    	<div class="label"><?php echo $entry['data']['film_jahr']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['film_jahr']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field film_titel_de">
    	<div class="label"><?php echo $entry['data']['film_titel_de']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['film_titel_de']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field film_sender">
    	<div class="label"><?php echo $entry['data']['film_sender']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['film_sender']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    <div class="field film_regie">
    	<div class="label"><?php echo $entry['data']['film_regie']['label']; ?></div>
    	<div class="value"><?php echo $entry['data']['film_regie']['value']; ?></div>
    	<div class="clear"></div>
    
    </div>
    
    
    
    
    <?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>
    
    <?php endforeach;?>
    
    </div>
    
    
    <?php else: ?>
    <p class="info">Invalid item reference for catalog.</p>
    <?php endif; ?>
  • Tim G
    Contao-Urgestein
    • 13.02.2010
    • 2212

    #2
    Hi,
    dazu gibt es bereits einen großen thread. auch mit templates, die ich dafür erstellt hatte.

    Für deine Problemstellung brauchst du eigentlich nur ein div element mit der css Klasse "toggler", oben innerhalb des layout_full divs, und ein umschliessendes div (klasse "accordion"), das den Rest umschliesst - also die foreach schleife etc.

    Grüße


    Sent from my iPhone using Tapatalk
    http://www.tim-gatzky.de ˙ auch schon wieder 2 Jahre alt - wie die Zeit vergeht... muss mal umbauen.

    Kommentar

    • Tim G
      Contao-Urgestein
      • 13.02.2010
      • 2212

      #3
      PHP-Code:
      <!-- autogenerated source for template : Schauspieler - xxx -->
      <!-- Date : 2011-06-12 18:36 -->
      
      
      <?php if (count($this->entries)): ?>
      
      <div class="layout_full">
      <div class="toggler">Klick mich</div>
      
      <div class="accordion">
      <?php foreach ($this->entries as $entry): ?>
      <div class="item">
      
      
      
      
      <div class="field film_jahr">
          <div class="label"><?php echo $entry['data']['film_jahr']['label']; ?></div>
          <div class="value"><?php echo $entry['data']['film_jahr']['value']; ?></div>
          <div class="clear"></div>
      
      </div>
      
      
      
      <div class="field film_titel_de">
          <div class="label"><?php echo $entry['data']['film_titel_de']['label']; ?></div>
          <div class="value"><?php echo $entry['data']['film_titel_de']['value']; ?></div>
          <div class="clear"></div>
      
      </div>
      
      
      
      <div class="field film_sender">
          <div class="label"><?php echo $entry['data']['film_sender']['label']; ?></div>
          <div class="value"><?php echo $entry['data']['film_sender']['value']; ?></div>
          <div class="clear"></div>
      
      </div>
      
      
      
      <div class="field film_regie">
          <div class="label"><?php echo $entry['data']['film_regie']['label']; ?></div>
          <div class="value"><?php echo $entry['data']['film_regie']['value']; ?></div>
          <div class="clear"></div>
      
      </div>
      
      
      
      
      <?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>
      
      <?php endforeach;?>
      
      </div>
      </div>
      
      
      <?php else: ?>
      <p class="info">Invalid item reference for catalog.</p>
      <?php endif; ?>
      http://www.tim-gatzky.de ˙ auch schon wieder 2 Jahre alt - wie die Zeit vergeht... muss mal umbauen.

      Kommentar

      Lädt...