Verwendung: Nachrichtenliste (News list boxed) flexibilität verleihen.

Joe Lehmann's Avatar

Joe Lehmann

17 Nov, 2025 05:23 PM

Produkt: Tao Contao

Hallo,
gibt es die Möglichkeit die Nachrichtenliste so einzustellen, dass sie die Spaltenanzahl in jeder Zeile automatis ändert.
Also 1. Zeile Nachrichten, 2. Spalte 2 Nachrichten usw. ?
Danke und mit freundlichen Grüßen
Lehmann

  1. Support Staff 1 Posted by RockSolid Theme... on 18 Nov, 2025 07:35 AM

    RockSolid Themes's Avatar

    Vielen Dank für Ihre Frage.

    Das sollte möglich sein indem Sie das Template templates/tao/news_list_boxed.html5 bearbeiten und abhängig von der $this->count-Variable unterschiedliche Spalten-Konfigurationen verwenden.

    Der Code dafür kann z. B. folgendermaßen aussehen:

    <?php
    if ($this->count < 2) {
        $config = array(
            'large' => array('-large-col-1-1 -large-first -large-last'),
            'medium' => array('-medium-col-1-1 -medium-first -medium-last'),
            'small' => array('-small-col-1-1 -small-first -small-last'),
        );
        $classes = array('rs-column');
        foreach ($config as $name => $media) {
            $classes[] = $media[($this->count - 1) % count($media)];
            if ($this->count - 2 < count($media)) {
                $classes[] = '-' . $name . '-first-row';
            }
        }
        $this->class .= ' ' . implode(' ', $classes);
    } else {
        $config = array(
            'large' => array('-large-col-3-1 -large-first', '-large-col-3-1', '-large-col-3-1 -large-last'),
            'medium' => array('-medium-col-2-1 -medium-first', '-medium-col-2-1 -medium-last'),
            'small' => array('-small-col-1-1 -small-first -small-last'),
        );
        $classes = array('rs-column');
        foreach ($config as $name => $media) {
            $classes[] = $media[($this->count - 2) % count($media)];
            if ($this->count - 3 < count($media)) {
                $classes[] = '-' . $name . '-first-row';
            }
        }
        $this->class .= ' ' . implode(' ', $classes);
    }
    
    include __DIR__ . '/news_list_boxed_item.html5';
    
  2. 2 Posted by Joe Lehmann on 18 Nov, 2025 11:14 AM

    Joe Lehmann's Avatar

    Hallo,

    danke fr die schnelle Antwort.

    Ich habe ein neues Template angelegtnews_list_boxed_vari.html5 und es
    mit dem Modul (News List Boxed) verknpft. Aber leider wird jetzt nichts
    angezeigt,
    siehe https://test.guestrowhockey.de/?page_n85=2.

    Wo hab ich da jetzt einen Fehler gemacht?

    Mit freundlichen Gren

    Lehmann

    Am 18.11.25 um 08:35 schrieb RockSolid Themes:

  3. Support Staff 3 Posted by RockSolid Theme... on 18 Nov, 2025 12:10 PM

    RockSolid Themes's Avatar

    Leider war noch ein Fehler im Beispiel-Code enthalten, die letzte Zeile sollte folgendermaßen lauten:

    include __DIR__ . '/news_list_boxed_item.html5';
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac