Ich muss doch nochmal fragen, vielleicht kann mir ja jemand einen Tipp geben, wie ich das hinkriege.
Meine Ausgabe im Eingabe-Modul sieht jetzt so aus:
Code: Alles auswählen
<?php
if (!isset($counter)) {
$counter = 0;
}
$counter++;
if (! rex::isBackend()) {
$items = array();
$items = ['title' => 'REX_VALUE[2]', 'text' => 'REX_VALUE[id=1 output=php]'];
rex::getProperty('tabs')->append($items);
// Im Backend wird der Inhalt als Info für den Redakteur angezeigt
} else {
if ('REX_VALUE[id=2 isset=1]') {
echo '<h2>REX_VALUE[2]</h2>';
}
if ('REX_VALUE[id=1 isset=1]') {
echo 'REX_VALUE[id=1 output=html]';
}
}
?>
Das gibt mir im Frontend auch das aus, was es soll, egal, ob ich HTML oder ein PHP-Script reinschreibe. Nur macht es mir die Tabs dann nicht. Die Ausgabe des Ausgabe-Moduls sieht so aus:
Code: Alles auswählen
<?php
// Im Frontend wird der Inhalt des Arrays ausgelesen und verarbeitet
if (!rex::isBackend()) {
$items = rex::getProperty('tabs')->getArrayCopy();
$tabs_title = '';
$tabs_text = '';
$tabs_out = '';
$counter = 1;
$title_style = 'title';
$content_style = 'content';
if ("REX_VALUE[1]" == 'tt' || "REX_VALUE[1]" == 'vt' || "REX_VALUE[1]" == 'bt') {
$title_style = 'tab-title';
$content_style = 'tab-content';
}
$one_open = ("REX_VALUE[3]" == 'one-open') ? " one-open" : "";
foreach ($items as $item) {
if (! isset($item['title'])) { $item['title'] = ''; };
if (! isset($item['text'])) { $item['text'] = ''; };
$active_title = '';
$active_text = '';
$tabs_title = $item['title'];
$tabs_text = $item['text'];
if ($tabs_title != '' && $tabs_text != '') {
if ($counter == 1) $active_title = ' class="active"';
$textile = $tabs_text;
// Bold-Tags werden "missbraucht", um Bootstrap-Labels setzen zu können.
$textile = str_replace(array('<b>', '</b>', '->'), array('<span class="label label-primary">', '</span>', '->'), $textile);
$tabs_out .= '
<li'.$active_title.'>
<div class="'.$title_style.'">
<span>'.$tabs_title.'</span>
</div>
<div class="'.$content_style.' text">'.$textile.'</div>
</li>';
}
$counter++;
}
?>
<section class="<?php if ($this->getTemplateId() == 1) echo 'container clearfix '; ?>tabs">
<div class="row">
<div class="col-md-8 col-md-offset-2 col-sm-12">
<?php
if ("REX_VALUE[2]" != '') {
echo '
<h3>REX_VALUE[2]</h3>';
}
if ("REX_VALUE[1]" == 'tt') { // Text-Tabs
echo '
<div class="tabbed-content text-tabs">';
} elseif ("REX_VALUE[1]" == 'vt') { // Vertikale Tabs
echo '
<div class="tabbed-content button-tabs vertical">';
} elseif ("REX_VALUE[1]" == 'bt') { // Button-Tabs
echo '
<div class="tabbed-content button-tabs">';
}
if ("REX_VALUE[1]" == 'ta') { // Text-Akkordions
echo '
<ul class="accordion accordion-2'.$one_open.'">'.
$tabs_out.'
</ul>';
} elseif ("REX_VALUE[1]" == 'ba') { // Button-Akkordions
echo '
<ul class="accordion accordion-1'.$one_open.'">'.
$tabs_out.'
</ul>';
} else {
echo '
<ul class="tabs">'.
$tabs_out.'
</ul>';
}
if ("REX_VALUE[1]" == 'tt' || "REX_VALUE[1]" == 'vt' || "REX_VALUE[1]" == 'bt') {
echo '
</div>';
}
?>
</div>
</div>
</section>
<?php
} else {
echo '
<p>Die Ausgabe erfolgt nur im Frontend.</p>';
}
?>
Ich bräuchte einen Anstoß, wie ich wieder an die Tabs komme. Der Sinn des Ganzen ist es, die Daten aus der Datenbank zu holen und direkt in Tabs auszugeben. Schaut mal hier, da sieht man, was es werden soll:
http://www.ninja4ever.de/index.php?article_id=37
Im Moment muss ich da jedesmal in den Tabellen rumfummeln, wenn ich was zufügen will. Es wäre viel einfacher, die Daten über ein Formular in die DB zu schubsen (kein Problem) und dann über eine Abfrage mit LIKE anzuzeigen (auch kein Problem).