<?php
###### Variabeln bestimmen ##################################################################################
$includeCss = phpConvertPageToFilesystemPath('blog:ernaehrung:vorlagen:tpl_fleischlos_produkt_css');
// ###### Pfad zur rechten Sidebar
$sidebarRight = phpConvertPageToFilesystemPath('blog:ernaehrung:vorlagen:tpl_sidebar_right_standard');
// ###### URL zur Anzeige von Bildern über http/https
$dokuwikiMediaUrl = 'https://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media=';
// ###### Rekursiv zu durchsuchendes Verzeichnis
$namespaceOfProduct = 'wiki:ernaehrung:marke:' . phpCreateDokuWikiConformName($product[$givenProductArrayId]['marke']['wert']) . ':' . phpCreateDokuWikiConformName($product[$givenProductArrayId]['produktlinie']['wert'] . ' -' . (!empty($product[$givenProductArrayId]['produktname']['wert']) ? ' ' . $product[$givenProductArrayId]['produktname']['wert']:'') . (!empty($product[$givenProductArrayId]['produktnamenszusatz']['wert']) ? ' ' . $product[$givenProductArrayId]['produktnamenszusatz']['wert']:'') );
$namespaceToImages = 'media:' . $namespaceOfProduct;
$convertedPath = strtolower(str_replace('pages/media', 'media', phpConvertNamespaceToFilesystemPath($namespaceToImages)));
// ###### Ausschluss-Verzeichnisse und -Dateien festlegen
$excludeArray = array ('.txt');
###### Variabeln korrigieren $blogPageData[$givenBlogArrayId]['blogPageCreationDate'] = date("d.m.Y",strtotime($blogPageData[$givenBlogArrayId]['blogPageCreationDate'])); $blogPageData[$givenBlogArrayId]['blogPageCreationTimeStamp'] = strtotime("{$blogPageData[$givenBlogArrayId]['blogPageCreationDate']} {$blogPageData[$givenBlogArrayId]['blogPageCreationTime']}"); $blogPageData[$givenBlogArrayId]['blogPageDataFile'] = $file; ###### Dateinamen-Prefix für Images anhand der Produktseite ermitteln
$imageFilePrefix = '';
$imageFilePrefixArray = explode('_',end(explode(':',$blogPageData[$givenBlogArrayId]['includeFileData'])));
foreach ($imageFilePrefixArray as $imageFilePrefixString) {
if (strstr($blogCoverString, '-')) {
$imageFilePrefix .= $imageFilePrefixString. '_';
} else {
$imageFilePrefix .= substr($imageFilePrefixString, 0, 3) . '_';
}
}
//###### Dateinamen für Blog-Cover ermitteln
if ((!isset($blogPageData[$givenBlogArrayId]['blogPageCover'])) || (empty($blogPageData[$givenBlogArrayId]['blogPageCover']))) {
$blogPageData[$givenBlogArrayId]['blogPageCover'] = $namespaceOfProduct . ':' . $imageFilePrefix . 'blog_cover.jpg';
}
//###### Dateinamen für Vergleichsbild 1 ermitteln
if ((!isset($blogPageData[$givenBlogArrayId]['blogPageImageComp1'])) || (empty($blogPageData[$givenBlogArrayId]['blogPageImageComp1']))) {
$blogPageData[$givenBlogArrayId]['blogPageImageComp1'] = $namespaceOfProduct . ':' . $imageFilePrefix . 'comp1.jpg';
}
//###### Dateinamen für Vergleichsbild 2 ermitteln
if ((!isset($blogPageData[$givenBlogArrayId]['blogPageImageComp2'])) || (empty($blogPageData[$givenBlogArrayId]['blogPageImageComp2']))) {
$blogPageData[$givenBlogArrayId]['blogPageImageComp2'] = $namespaceOfProduct . ':' . $imageFilePrefix . 'comp2.jpg';
}
###### CSS-Datei inkludieren ##################################################################################
include($includeCss);
###### HTML-Tag öffnen ##################################################################################
echo '<html>';
###### Vorbereitungen Slideshow (JavaScript-Funktion) ##################################################################################
// ###### Alle Dateien am angegebenen Pfad finden, exklusive der ausgeschlossenen
$images = recursiveScan($convertedPath, $excludeArray);
array_multisort($images, SORT_ASC, $images);
// ###### Define and fill array in JavaScript with array from PHP
echo '
<script language="javascript">
var galleryarray=new Array();
';
// ######Output it as a JavaScript array element
for ($arrayCounter = 0; $arrayCounter < count($images); $arrayCounter++) {
echo 'galleryarray[' . $arrayCounter . '] = "' . $dokuwikiMediaUrl . $images[$arrayCounter] . '";';
}
echo '
function rotateimages(givenimage){
document.getElementById("slideshow").setAttribute("src", galleryarray[givenimage])
}
</script>
';
###### Darstellungsstruktur ##################################################################################
echo '
<div class="parentbox"><!-- ###### parentbox umspannender Inhalts-Container (öffnen) -->
<div class="sectionbox-row"><!-- ###### Sectionbox für Spalten im umspannenden Inhalts-Container (öffnen) -->
<div class="contentbox-left"><!-- ###### Linke Spalte (öffnen) -->
<div class="dateBox">Beitrag vom ' . $blogPageData[$givenBlogArrayId]['blogPageCreationDate'] . ' auf ' . $_SERVER['SERVER_NAME'] . '</div><br /><br />
<div class="titlebox"><!-- ###### titlebox (Produktname) (öffnen)-->
<div class="titlebox-top"></html>' . $product[$givenProductArrayId]['marke']['wert'] . ' \\\\ ' . $product[$givenProductArrayId]['produktlinie']['wert'] . ' \\\\ ' . $product[$givenProductArrayId]['produktname']['wert'] . ' ' . $product[$givenProductArrayId]['produktnamenszusatz']['wert'] . '<html></div>
<div class="titlebox-bottom">Erfahrungsbericht</div>
</div><!-- ###### titlebox (Produktname) (schließen)-->
<div class="sectionbox-column"><!-- ###### sectionbox (Produktbild) (öffnen) -->
<div class="coverbox-image-center"></html>{{' . $namespaceOfProduct . ':product_cover.jpg?nolink}}<html></div>
</div><!-- ###### sectionbox (Produktbild) (schließen) -->
<div class="sectionbox-row"><!-- ###### sectionbox (Eyecatcher) (schließen) -->
<div class="contentbox">' . $blogPageData[$givenBlogArrayId]['blogPageEyeCatcher'] . '</div>
</div><!-- ###### sectionbox (Eyecatcher) (schließen) -->
<div class="sectionbox-row"><!-- ###### sectionbox (Vorwort) (öffnen)-->
<div class="contentbox">Vorwort
<div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPagePreamble'] . '<html></div>
</div>
</div><!-- ###### sectionbox (Vorwort) (schließen)-->
<div class="sectionbox-row"><!-- ###### sectionbox (Erster Eindruck) (öffnen) -->
<div class="contentbox">Der erste Eindruck
<div class="contentbox-information"></html>' . reset(explode('<split>', $blogPageData[$givenBlogArrayId]['blogPageFirstImpression'])) . '<html></div>
<div class="coverbox-image-center">
<img id="slideshow" src="' . $dokuwikiMediaUrl . $images[0] . '" />
</div>
<div class="imageRibbon" style="height: 150px; margin-top: 1vw; overflow: auto; display: flex; flex-direction: row;"><!-- ###### Thumbnail-Ribbon aller Images (öffnen) -->
<div class "imageRibbonContent" style="height: 100%; margin-left: auto; margin-right: auto; white-space: nowrap;">
';
for ($arrayCounter = 0; $arrayCounter < count($images); $arrayCounter++) {
echo '<img style="height: 100%;" id="slideshow" onclick="rotateimages(' . $arrayCounter . '); return false;" onmouseover="rotateimages(' . $arrayCounter . '); return false;" src="' . $dokuwikiMediaUrl . $images[$arrayCounter]. '" />';
}
echo'
</div>
</div><!-- ###### Thumbnail-Ribbon aller Images (schließen) -->
<div class="contentbox-information"></html>' . end(explode('<split>', $blogPageData[$givenBlogArrayId]['blogPageFirstImpression'])) . '<html></div>
</div>
</div><!-- ###### sectionbox (Erster Eindruck) (schließen) -->
<div class="sectionbox-row"><!-- ###### sectionbox (Was steckt drin) (öffnen) -->
<div class="contentbox">Was steckt drin
<div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPageInsideProduct'] . '<html></div>
</div>
</div><!-- ###### sectionbox (Was steckt drin) (schließen) -->
<div class="sectionbox-row"><!-- ###### sectionbox (Zutaten) (öffnen) -->
<div class="contentbox">Die Zutaten (Stand: ' . $blogPageData[$givenBlogArrayId]['blogPageCreationDate'] . ')
<div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPageIngredients'] . ' [[blog:ernaehrung:vorlagen:tpl_fleischlos_produkt_bewertung_call?currentPageId=' . end(explode(':',$blogPageData[$givenBlogArrayId]['includeFileData'])) . '¤tBlogContentFile=' . $_GET['currentBlogContentFile'] . '|Produktdetails...]]<html></div>
</div>
</div><!-- ###### sectionbox (Zutaten) (schließen) -->
<div class="sectionbox-row"><!-- ###### sectionbox (Die Stunde der Wahrheit) (öffnen) -->
<div class="contentbox">Die Stunde der Wahrheit
<div class="contentbox-information"></html>' . reset(explode('<split>', $blogPageData[$givenBlogArrayId]['blogPageMainTest'])) . '<html></div>
<div class="sectionbox-row">
<div class="coverbox-image-center"></html>{{' . $namespaceOfProduct . ':blog_comp1.jpg?nolink}}Abb.1 ' . $blogPageData[$givenBlogArrayId]['blogPageImageComp1Note'] .'<html></div>
<div class="coverbox-image-center"></html>{{' . $namespaceOfProduct . ':blog_comp2.jpg?nolink}}Abb.2 ' . $blogPageData[$givenBlogArrayId]['blogPageImageComp2Note'] .'<html></div>
</div>
<div class="contentbox-information"></html>' . end(explode('<split>', $blogPageData[$givenBlogArrayId]['blogPageMainTest'])) . '<html></div>
</div>
</div><!-- ###### sectionbox (Die Stunde der Wahrheit) (schließen) -->
<div class="sectionbox-row"><!-- ###### ###### sectionbox (Fazit) (öffnen) -->
<div class="contentbox">Fazit
<div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPageConclusion'] . '<html></div>
</div>
</div><!-- ###### ###### sectionbox (Fazit) (schließen) -->
</div><!-- ###### Linke Spalte (schließen) -->
<div class="contentbox-right"><!-- ###### ###### Rechte Spalte (öffnen) -->
';
include($sidebarRight);
echo '
</div><!-- ###### ###### Rechte Spalte (schließen) -->
</div><!-- ###### Sectionbox für Spalten im umspannenden Inhalts-Container (schließen) --> </div><!-- ###### parentbox umspannender Inhalts-Container (schließen) --> ';
###### JavaScript - tatsächliche Größe der ParentBox bestimmen und festlegen ##################################################################################
echo '
<script language="javascript">
var biggestHeight = 0;
// Loop through elements children to find & set the biggest height
$(".parentbox*").each(function(){
// If this elements height is bigger than the biggestHeight
if ($(this).height() > biggestHeight ) {
// Set the biggestHeight to this Height
biggestHeight = $(this).height();
}
});
// Set the container height
$(".parentbox").height(biggestHeight);
</script>
';
###### HTML-Tag schließen ##################################################################################
echo '</html>';
?>