<?php
Blog-Daten-Datei ermitteln $includeBlogData = str_replace(end(explode(':', $_GET["id"])), 'pagedata:' . end(explode(':', $_GET["id"])), $_GET["id"]); ###### Variabeln bestimmen ################################################################################## ###### Rechte Sidbar
$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=';
Fehlermeldung, falls keine Datendatei vorhanden ist (sollte nicht auftreten, da von Startseite generiert) if (!(file_exists(phpConvertPageToFilesystemPath($includeBlogData)))) { echo '<html>
Es existiert kein Datensatz
</div>
</html>';
exit();
}
Blog-Daten inkludieren include(phpConvertPageToFilesystemPath($includeBlogData)); ###### ID des aktuellen Array-Elements ermitteln
end($blogPageData);
$givenBlogArrayId = key($blogPageData);
//###### zugehoeriges Pagedata-Verzeichnis ermitteln
$namespaceOfBlogPagedata = str_replace(':' . end(explode(':',$includeBlogData)), '', $includeBlogData);
$filePathOfBlogPagedataImages = str_replace('/data/pages/', '/data/media/', phpConvertNamespaceToFilesystemPath($namespaceOfBlogPagedata));
Bild-Daten sammeln und korrigieren ###### Alle Bilder am angegebenen Pfad finden (hier Blog-Mediendateien)
//###### zugehoeriges Medien-Verzeichnis ermitteln
$namespaceOfBlogImages = 'media:' . $includeBlogData;
$filePathOfBlogImages = str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath($namespaceOfBlogImages));
//###### Alle Blog-Images sammeln
$images = getAllImages(strtolower($filePathOfBlogImages), $excludeArray);
//###### Wurden Bilder gefunden
if (isset($images)) {
//###### Alle Bilder am angegebenen Pfad finden (hier Produkt-Mediendateien)
array_multisort($images, SORT_ASC, $images);
//###### Bilder des Arrays popElements entfernen und neu
$popElements = array('blog_cover',);
for ($counter=sizeof($images); $counter >=0; $counter--) {
foreach ($popElements as $popElement) {
if (strpos($images[$counter], $popElement)) {
unset($images[$counter]);
}
}
}
sort($images);
//###### Gallerie-Ribbon-String mit allen Bildern erstellen
$imageRibbonString = '';
for ($arrayCounter = 0; $arrayCounter < count($images); $arrayCounter++) {
$imageRibbonString .= '<img style="height: 100%; border-radius: var(--global-font-size); border: solid var(--global-border-size) lightgrey;" id="slideshow" onclick="rotateimages(' . $arrayCounter . '); return false;" onmouseover="rotateimages(' . $arrayCounter . '); return false;" src="' . $dokuwikiMediaUrl . $images[$arrayCounter]. '" />';
}
}
//###### Lightbox-Funktionen-String erstellen (JavaScript)
$jsLightboxFunctions = '';
// ###### Define and fill array in JavaScript with array from PHP
$jsLightboxFunctions .= '
<script language="javascript">
var galleryarray=new Array();
';
// ######Output it as a JavaScript array element
for ($arrayCounter = 0; $arrayCounter < count($images); $arrayCounter++) {
$jsLightboxFunctions .= 'galleryarray[' . $arrayCounter . '] = "' . $dokuwikiMediaUrl . $images[$arrayCounter] . '";';
}
$jsLightboxFunctions .= '
function rotateimages(givenimage){
document.getElementById("enlargedImage").setAttribute("src", galleryarray[givenimage]);
document.getElementById("previewImage").setAttribute("src", galleryarray[givenimage]);
img = document.getElementById("previewImage")
if (img.naturalWidth > img.naturalHeight) {
img.style = "width: 100%; height: auto; top: 50%; transform: translateY(-50%);";
} else {
img.style = "width: auto; height: 100%; left: 50%; transform: translateX(-50%);";
}
}
function fullscreen() {
imgDiv = document.getElementById("fullscreenimage");
imgDiv.style = "visibility: visible;";
img = document.getElementById("enlargedImage")
if (img.naturalWidth > img.naturalHeight) {
img.style = "width: 100%; height: auto; top: 50%; transform: translateY(-50%);";
} else {
img.style = "width: auto; height: 100%; left: 50%; transform: translateX(-50%);";
}
}
function thumbnail() {
img = document.getElementById("fullscreenimage");
img.style = "visibility: hidden;";
}
function resizeImage( idName ) {
img = document.getElementById(idName);
if (img.naturalWidth > img.naturalHeight) {
img.style = "width: 100%; height: auto; top: 50%; transform: translateY(-50%);";
} else {
img.style = "width: auto; height: 100%; left: 50%; transform: translateX(-50%);";
}
}
';
$jsLightboxFunctions .= '
</script>
';
Standard-Bilder pruefen ###### Vergleichsbild 1 suchen und korrigieren
if (file_exists($filePathOfBlogImages . '/blog_comp1.png')) {
$imageBlogComp1 = $includeBlogData . ':blog_comp1.png';
} elseif (file_exists($filePathOfBlogImages . '/blog_comp1.jpg')) {
$imageBlogComp1 = $includeBlogData . ':blog_comp1.jpg';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_comp1.png')) {
$imageBlogComp1 = $namespaceOfBlogPagedata . ':standard_blog_comp1.png';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_comp1.jpg')) {
$imageBlogComp1 = $namespaceOfBlogPagedata . ':standard_blog_comp1.jpg';
} else {
$imageBlogComp1 = '';
}
//###### Vergleichsbild 2 suchen und korrigieren
if (file_exists($filePathOfBlogImages . '/blog_comp2.png')) {
$imageBlogComp2 = $includeBlogData . ':blog_comp2.png';
} elseif (file_exists($filePathOfBlogImages . '/blog_comp2.jpg')) {
$imageBlogComp2 = $includeBlogData . ':blog_comp2.jpg';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_comp2.png')) {
$imageBlogComp2 = $namespaceOfBlogPagedata . ':standard_blog_comp2.png';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_comp2.jpg')) {
$imageBlogComp2 = $namespaceOfBlogPagedata . ':standard_blog_comp2.jpg';
} else {
$imageBlogComp2 = '';
}
//###### Zutatenbild suchen und korrigieren
if (file_exists($filePathOfBlogImages . '/blog_ingredients.png')) {
$imageIngredients = $includeBlogData . ':blog_ingredients.png';
} elseif (file_exists($filePathOfBlogImages . '/blog_ingredients.jpg')) {
$imageIngredients = $includeBlogData . ':blog_ingredients.jpg';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_ingredients.png')) {
$imageIngredients = $namespaceOfBlogPagedata . ':standard_blog_ingredients.png';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_blog_ingredients.jpg')) {
$imageIngredients = $namespaceOfBlogPagedata . ':standard_blog_ingredients.jpg';
} else {
$imageIngredients = '';
}
//###### Produktbild suchen und korrigieren
if (file_exists($filePathOfBlogImages . '/product_cover.png')) {
$imageProduct = $includeBlogData . ':product_cover.png';
} elseif (file_exists($filePathOfBlogImages . '/product_cover.jpg')) {
$imageProduct = $includeBlogData . ':product_cover.jpg';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_product_cover.png')) {
$imageProduct = $namespaceOfBlogPagedata . ':standard_product_cover.png';
} elseif (file_exists($filePathOfBlogPagedataImages . '/standard_product_cover.jpg')) {
$imageProduct = $namespaceOfBlogPagedata . ':standard_product_cover.jpg';
} else {
$imageProduct = '';
}
CSS-Datei vorgeben $blogPageData[$givenBlogArrayId]['includeFileTemplateCss'] = 'blog:ernaehrung:vorlagen:nsp_tpl_blog_ernaehrung_produkttests_css'; Fehlermeldung, falls keine CSS-Datei vorhanden ist
if ( (empty($blogPageData[$givenBlogArrayId]['includeFileTemplateCss'])) || (!(file_exists(phpConvertPageToFilesystemPath($blogPageData[$givenBlogArrayId]['includeFileTemplateCss']))))) {
echo '<html>
<div style="width: 100%; height: 100px; padding-top:100px; text-align: center; border: 2px solid black; font-weight: bold; font-size: 2vw;">
Es existiert keine Style-Sheet-Datei
</div>
</html>';
exit();
}
CSS-Datei inkludieren include(phpConvertPageToFilesystemPath($blogPageData[$givenBlogArrayId]['includeFileTemplateCss'])); ###### 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;
###### HTML-Tag öffnen ##################################################################################
echo '<html>';
###### JavaScript-Funktionen einbinden, falls gesetzt ##################################################################################
if (isset($jsLightboxFunctions)) { echo $jsLightboxFunctions; }
###### Darstellungsstruktur ##################################################################################
echo '
<div id="fullscreenimage" class="gallerybox-image-full-overlay">
<div onclick="thumbnail()" class="gallerybox-image-full-overlay-image">✗<img id="enlargedImage" src="' . $dokuwikiMediaUrl . $images[0] . '"></div>
</div>
<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>' . str_replace('\\', ' \\\\ ', reset(explode('||',$blogPageData[$givenBlogArrayId]['blogPageTitle']))) . '<html></div>
<div class="titlebox-bottom">' . ( (strpos($blogPageData[$givenBlogArrayId]['blogPageTitle'],'||')) ? end(explode('||',$blogPageData[$givenBlogArrayId]['blogPageTitle'])) : '' ) . '</div>
</div><!-- ###### titlebox (Produktname) (schließen)-->
<div class="sectionbox-row"><!-- ###### sectionbox (Produktbild) (öffnen) -->
<div class="coverbox-image-product-center"></html>{{' . $imageProduct . '?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>' . $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="gallerybox-image-center">
<img id="ingredientsImage" src="' . $dokuwikiMediaUrl . $imageIngredients . '">
</div>
<script language="JavaScript">resizeImage("ingredientsImage");</script>
<div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPageIngredients'] . ( (!empty($blogPageData[$givenBlogArrayId]['blogPageReferencePage'])) ? ' [[' . $blogPageData[$givenBlogArrayId]['blogPageReferencePage'] . '?currentBlogContentFile=' . $_GET['currentBlogContentFile'] . '|Produktbewertung...]]':'' ) . '<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-product-center"></html>{{' . $imageBlogComp1 . '?nolink}}Abb.1 vegetarisch<html></div>
<div class="coverbox-image-product-center"></html>{{' . $imageBlogComp2 . '?nolink}}Abb.2 fleischlich<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) -->';
if (isset($images)) {
echo'
<div class="sectionbox-row"><!-- ###### sectionbox (Gellerie) (öffnen) -->
<div class="contentbox">Gallerie
<div onclick="fullscreen()" class="gallerybox-image-center">
<img id="previewImage" src="' . $dokuwikiMediaUrl . $images[0] . '">
</div>
<script language="JavaScript">rotateimages(0);</script>
<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;">' . $imageRibbonString . '</div>
</div><!-- ###### Thumbnail-Ribbon aller Images (schließen) -->
</div>
</div><!-- ###### sectionbox (Gellerie) (schließen) -->
';
}
echo'
</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>';
?>