Section & Article anlegen (Template ändern)

Um mit Elementen wie  <section> und <article> arbeiten zu können, ohne nur reinen HTML-Code zu schreiben, können auch Module im Template abgeänder werden.

So könnte für <section> das Tempalte mod__article kopiert und geändert werden. Statt dem <div> <section> eintragen.

Für <article> das Template ce_text abändern. statt <div>  <article> einsetzen.

Hinweis: </div> jeweisl austauschen mit </article> / </section>

Bei den jeweiligen Template-Einstellungen muß dann das individuelle Template aktivert werden.

Aus DIV wird article

Aus ce_text wird ein ce_article. F12

Dazu das Template "ce_text" ändern (siehe nachfolgendes PHP), z.B. in  "ce_article"  und dieses anschließend in den  individuellen Template-Einstellungen  aktivieren .

Achtung: Beispiel noch von Contao 3.x

<article class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
 

 
  <?php if ($this->headline): ?>
    <<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>>
  <?php endif; ?>
 
  <?php if (!$this->addBefore): ?>
    <?= $this->text ?>
  <?php endif; ?>
 
  <?php if ($this->addImage): ?>
    <figure class="image_container<?= $this->floatClass ?>"<?php if ($this->margin): ?> style="<?= $this->margin ?>"<?php endif; ?>>
 
      <?php if ($this->href): ?>
        <a href="<?= $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
      <?php endif; ?>
 
      <?php $this->insert('picture_default', $this->picture); ?>
 
      <?php if ($this->href): ?>
        </a>
      <?php endif; ?>
 
      <?php if ($this->caption): ?>
        <figcaption class="caption"><?= $this->caption ?></figcaption>
      <?php endif; ?>
 
    </figure>
  <?php endif; ?>
 
  <?php if ($this->addBefore): ?>
    <?= $this->text ?>
  <?php endif; ?>
 

</article>