Hallo Community,
versuche gerade das ce_text.html5 (Contao 2.10.2) Template meinen Bedürfnissen anzupassen, es gibt aber ein Problem das ich nicht verstehe:
- Wird ein Textelement im BE mit Bild (über " ein Bild hinzufügen", nicht im TinyMCE Editor selbst) erstellt so wird der Text (
PHP-Code:
<?php echo $this->text; ?>
im Template) im FE nach dem Bild eingefügt,
- wird ein Textelement im BE ohne Bild erstellt so wird der Text nach der h1 im oberen Teil des Templates eingefügt...
verantwortlich ist wohl folgender PHP Code vor und nach dem -
PHP-Code:
<?php if ($this->addImage): ?>
-Teil:
PHP-Code:
<?php if ($this->addBefore): ?>
<?php echo $this->text; ?>
<?php endif; ?>
Hier verstehe ich nicht wie das "addBefore" funktioniert und was da bedingt passiert.
Denn ich will daß der Text immer im oberen Teil nach der h1 ausgegeben wird, egal ob mit oder ohne hinzugefügtem Bild, meine Templateänderungen kapseln die h1 und den Text in
HTML-Code:
<div class="text">
:
HTML-Code:
<section class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<div class="text">
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<?php if (!$this->addBefore): ?>
<?php echo $this->text; ?>
<?php endif; ?>
</div>
<?php if ($this->addImage): ?>
<figure class="image_container<?php echo $this->floatClass; ?>"<?php if ($this->margin || $this->float): ?> style="<?php echo trim($this->margin . $this->float); ?>"<?php endif; ?>>
<?php if ($this->href): ?>
<a href="<?php echo $this->href; ?>"<?php echo $this->attributes; ?> title="<?php echo $this->alt; ?>">
<?php endif; ?>
<img src="<?php echo $this->src; ?>"<?php echo $this->imgSize; ?> alt="<?php echo $this->alt; ?>">
<?php if ($this->href): ?>
</a>
<?php endif; ?>
<?php if ($this->caption): ?>
<figcaption class="caption"><?php echo $this->caption; ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<?php if ($this->addBefore): ?>
<?php echo $this->text; ?>
<?php endif; ?>
</section>
Wenn ich das
PHP-Code:
<?php if ($this->addBefore): ?>
<?php echo $this->text; ?>
<?php endif; ?>
nach bem Bild im unteren Teil auskommentiere, so erscheint bei ausgewähltem Bild gar kein Text... ???
kommentiere ich das "addBefore" im oberen Teil noch zusätzlich aus, kommt immer noch kein Text, obwohl das
PHP-Code:
<?php echo $this->text; ?>
stehen bleibt:
HTML-Code:
<section class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<div class="text">
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<!--<?php if (!$this->addBefore): ?>-->
<?php echo $this->text; ?>
<!--<?php endif; ?>-->
</div>
<?php if ($this->addImage): ?>
<figure class="image_container<?php echo $this->floatClass; ?>"<?php if ($this->margin || $this->float): ?> style="<?php echo trim($this->margin . $this->float); ?>"<?php endif; ?>>
<?php if ($this->href): ?>
<a href="<?php echo $this->href; ?>"<?php echo $this->attributes; ?> title="<?php echo $this->alt; ?>">
<?php endif; ?>
<img src="<?php echo $this->src; ?>"<?php echo $this->imgSize; ?> alt="<?php echo $this->alt; ?>">
<?php if ($this->href): ?>
</a>
<?php endif; ?>
<?php if ($this->caption): ?>
<figcaption class="caption"><?php echo $this->caption; ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<!--<?php if ($this->addBefore): ?>
<?php echo $this->text; ?>
<?php endif; ?>--!
</section>
und jetzt weiß ich nicht weiter, hat da jemand eine Idee?
Ich hätte gerne zwei Blöcke <h1 und Text> und optional <Bild> die ich floaten kann...
Lesezeichen