Ergebnis 1 bis 13 von 13

Thema: Ungewollte   in leerer Tabellenzelle

  1. #1
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Frage Ungewollte   in leerer Tabellenzelle

    Leider können leere Tabellenzellen nicht per CSS mit "empty-cells: hide" formatiert werden, denn Contao lässt beim Inhaltselement "Tabelle" keine Zelle leer.

    So soll die Tabelle aussehen (ohne Trennlinien bei leeren Zellen)
    tabelle_soll.png

    und so sieht sie aus
    tabelle_ist.png

    Ursache ist, dass Contao in jede Zelle, die im Backend leer gelassen wird, im Frontend einen " " einsetzt. Und die Ersetzung passiert offenbar nicht im Template "ce_table.html5" - sonst könnte ich sie leicht abschalten. Wie werde ich die ungewollten (und für heutige Browser überflüssigen) " " los??

    Danke schonmal!

  2. #2
    Administratorin Avatar von lucina
    Registriert seit
    19.06.2009.
    Ort
    Kiel (DE)
    Beiträge
    7.337
    Partner-ID
    152
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Ich sehe da keinen Unterschied, sorry.

  3. #3
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    HTML

    Bei "tabelle_soll" gibt es unter W.A. Mozart erstmal keine Trennlinien. So wird deutlich, dass die 5 rechts aufgeführten Opern von Mozart stammen.

  4. #4
    Administratorin Avatar von lucina
    Registriert seit
    19.06.2009.
    Ort
    Kiel (DE)
    Beiträge
    7.337
    Partner-ID
    152
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Ah, jetzt ... ;-)

    In der contentTable.php ist das Leerzeichen in Zeile 102 enthalten. Womöglich kannst Du das mit einem eigenen Modul überschreiben.

  5. #5
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Lächelndes Gesicht

    Danke für den Tipp! Das hätte ich nie gefunden.

  6. #6
    Contao-Urgestein
    Registriert seit
    03.06.2010.
    Ort
    Wuppertal
    Beiträge
    2.149
    User beschenken
    Wunschliste

    Standard

    Alternativ geht das auch mit einem angepassten ce_table.html5

    PHP-Code:
    <?php if($col['content'] == '&nbsp;' || $col['content'] == '[nbsp]')
    {
      
    $col['content'] = '';
    }
    ?>
    <div class="<?php echo $this->class?> block"<?php echo $this->cssID?><?php if ($this->style): ?> style="<?php echo $this->style?>"<?php endif; ?>>

      <?php if ($this->headline): ?>
        <<?php echo $this->hl?>><?php echo $this->headline?></<?php echo $this->hl?>>
      <?php endif; ?>

      <table id="<?php echo $this->id?>"<?php if ($this->sortable): ?> class="sortable"<?php endif; ?>>

        <?php if ($this->useHeader): ?>
          <thead>
            <tr>
              <?php foreach ($this->header as $col): ?>
                <th class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th>
              <?php endforeach; ?>
            </tr>
          </thead>
        <?php endif; ?>

        <?php if ($this->useFooter): ?>
          <tfoot>
            <tr>
              <?php foreach ($this->footer as $col): ?>
                <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td>
              <?php endforeach; ?>
            </tr>
          </tfoot>
        <?php endif; ?>

        <tbody>
          <?php foreach ($this->body as $class=>$row): ?>
            <tr class="<?php echo $class?>">
              <?php foreach ($row as $i=>$col): ?>
                <?php if ($i == && $this->useLeftTh): ?>
                  <th scope="row" class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th>
                <?php else: ?>
                  <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td>
                <?php endif; ?>
              <?php endforeach; ?>
            </tr>
          <?php endforeach; ?>
        </tbody>

      </table>

    </div>
    Ungetestet und ich weiß gerade nicht ob das schon &nbsp; oder noch [nbsp] ist.

  7. #7
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Frage

    Du hast die ersten 5 Zeilen ergänzt und sonst keine Änderung gemacht?

    Funktioniert leider nicht. Contao macht in Zeile 1 beim Speichern aus dem &nbsp; ein [nbsp]. Ich weiß aber nicht, ob das der Grund fürs Nichtfunktionieren ist...

  8. #8
    Contao-Urgestein
    Registriert seit
    03.06.2010.
    Ort
    Wuppertal
    Beiträge
    2.149
    User beschenken
    Wunschliste

    Standard

    Ja, nicht nachgedacht...

    Versuch es mal so:

    PHP-Code:
    <div class="<?php echo $this->class?> block"<?php echo $this->cssID?><?php if ($this->style): ?> style="<?php echo $this->style?>"<?php endif; ?>

      <?php if ($this->headline): ?> 
        <<?php echo $this->hl?>><?php echo $this->headline?></<?php echo $this->hl?>
      <?php endif; ?> 

      <table id="<?php echo $this->id?>"<?php if ($this->sortable): ?> class="sortable"<?php endif; ?>

        <?php if ($this->useHeader): ?> 
          <thead> 
            <tr> 
              <?php foreach ($this->header as $col): 
              if(
    $col['content'] == '&nbsp;' || $col['content'] == '[nbsp]'
              { 
                
    $col['content'] = ''
              } 
              
    ?> 
                <th class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th> 
              <?php endforeach; ?> 
            </tr> 
          </thead> 
        <?php endif; ?> 

        <?php if ($this->useFooter): ?> 
          <tfoot> 
            <tr> 
              <?php foreach ($this->footer as $col): 
              if(
    $col['content'] == '&nbsp;' || $col['content'] == '[nbsp]'
              { 
                
    $col['content'] = ''
              } 
              
    ?> 
                <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td> 
              <?php endforeach; ?> 
            </tr> 
          </tfoot> 
        <?php endif; ?> 

        <tbody> 
          <?php foreach ($this->body as $class=>$row): ?> 
            <tr class="<?php echo $class?>"> 
              <?php foreach ($row as $i=>$col): 
              if(
    $col['content'] == '&nbsp;' || $col['content'] == '[nbsp]'
              { 
                
    $col['content'] = ''
              } 
              
    ?> 
                <?php if ($i == && $this->useLeftTh): ?> 
                  <th scope="row" class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th> 
                <?php else: ?> 
                  <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td> 
                <?php endif; ?> 
              <?php endforeach; ?> 
            </tr> 
          <?php endforeach; ?> 
        </tbody> 

      </table> 

    </div>

  9. #9
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Gesicht zeigt die Zunge

    Nö, das funktioniert leider auch nicht.

    Kann das denn daran liegen, dass Contao beim Speichern jeden &nbsp; in [nbsp] ändert?

  10. #10
    Contao-Urgestein
    Registriert seit
    03.06.2010.
    Ort
    Wuppertal
    Beiträge
    2.149
    User beschenken
    Wunschliste

    Standard

    Deshalb prüfe ich eigentlich auf beides... War mir nicht sicher an welcher Stelle die Ausgabe ersetzt wird.

    Ich teste das mal bei mir.

  11. #11
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Gesicht zeigt die Zunge

    Das &nbsp; Deiner zusätzlichen Zeilen im Template wird ja schon direkt beim Template-Speichern in [nbsp] umgewandelt. Die Prüfung auf beides findet also garnicht statt.

  12. #12
    Contao-Urgestein
    Registriert seit
    03.06.2010.
    Ort
    Wuppertal
    Beiträge
    2.149
    User beschenken
    Wunschliste

    Standard

    Im Template ist es aber bereits wieder umgewandelt, aber aus irgendeinem Grund kann ich da keinen Stringvergleich machen... Kapier ich gerade nicht, aber egal, so funktioniert es:

    PHP-Code:
    <div class="<?php echo $this->class?> block"<?php echo $this->cssID?><?php if ($this->style): ?> style="<?php echo $this->style?>"<?php endif; ?>>

      <?php if ($this->headline): ?>
        <<?php echo $this->hl?>><?php echo $this->headline?></<?php echo $this->hl?>>
      <?php endif; ?>

      <table id="<?php echo $this->id?>"<?php if ($this->sortable): ?> class="sortable"<?php endif; ?>>

        <?php if ($this->useHeader): ?>
          <thead>
            <tr>
              <?php foreach ($this->header as $col): ?>
                <th class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th>
              <?php endforeach; ?>
            </tr>
          </thead>
        <?php endif; ?>

        <?php if ($this->useFooter): ?>
          <tfoot>
            <tr>
              <?php foreach ($this->footer as $col): ?>
                <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td>
              <?php endforeach; ?>
            </tr>
          </tfoot>
        <?php endif; ?>

        <tbody>
          <?php foreach ($this->body as $class=>$row): ?>
            <tr class="<?php echo $class?>">
              <?php foreach ($row as $i=>$col): 
              if(
    strpos($col['content'], '&nbsp') !== false && strlen($col['content']) == 6)
              {
                
    $col['content'] = '';
              }
              
    ?>
                <?php if ($i == && $this->useLeftTh): ?>
                  <th scope="row" class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></th>
                <?php else: ?>
                  <td class="<?php echo $col['class']; ?>"><?php echo $col['content']; ?></td>
                <?php endif; ?>
              <?php endforeach; ?>
            </tr>
          <?php endforeach; ?>
        </tbody>

      </table>

    </div>

  13. #13
    Contao-Nutzer Avatar von Stef
    Registriert seit
    28.11.2011.
    Ort
    Bergisch Gladbach
    Beiträge
    11

    Lachendes Gesicht

    Super, &nbsp; -Problem gelöst!

    Danke, Flex.

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •