hasError && $contentManager->displayType == EContentDisplayType::DISPLAY) { $content = load_content_by_file_path($contentManager->contentFilepath); if(is_null($content)) { $contentManager->hasError = true; $contentManager->errorMessageKey = "content.error.message.cannot.load"; } } $content_error_message = localize($contentManager->errorMessageKey); // Checking if an error occurred while loading data and parsing the URL. // And if not, enabling special features. $content_error_code = 200; if($contentManager->hasError) { // TODO: Add condition for the lack of data for an item. if(is_null($contentManager->rootIndexEntries)) { // Failed to get a display type or to extract types. header("HTTP/1.1 400 Bad Request"); $content_error_code = 400; } else { //Other error. (No article, ...) header("HTTP/1.1 500 Internal Server Error"); $content_error_code = 500; } } else { $enable_code_highlight = true; $enable_gallery = true; } ?> hasError) { $content_head_title = localize("content.error.head.title"); $content_head_description = $content_error_message; $content_head_og_title = localize("content.error.og.title"); $content_head_og_description = $content_error_message; } elseif($contentManager->displayType == EContentDisplayType::DISPLAY) { $content_head_title = localize("content.item.head.title.prefix") . $content->get_head_title() . localize("content.item.head.title.suffix"); $content_head_description = $content->get_head_description(); $content_head_og_title = localize("content.item.og.title.prefix") . $content->get_head_title() . localize("content.item.og.title.suffix"); $content_head_og_description = $content->get_head_description(); if(!is_null($content->metadata->opengraph->image)) { $content_head_image = $host_uri . $content->metadata->opengraph->image; } if(!is_null($content->metadata->opengraph->image_type)) { $content_head_image_type = $content->metadata->opengraph->image_type; } else { switch(pathinfo($content_head_image, PATHINFO_EXTENSION)) { case "png": $content_head_image_type = "image/png"; break; case "jpg": case "jpeg": $content_head_image_type = "image/jpeg"; break; case "gif": $content_head_image_type = "image/gif"; break; case "svg": $content_head_image_type = "image/svg+xml"; break; case "webp": $content_head_image_type = "image/webp"; break; case "apng": $content_head_image_type = "image/apng"; break; } } } elseif($contentManager->displayType == EContentDisplayType::SEARCH) { $content_head_title = localize("content.search.head.title"); $content_head_description = localize("content.search.head.description"); $content_head_og_title = localize("content.search.og.title"); $content_head_og_description = localize("content.search.og.description"); } // TODO: Fix the OG URL tag to add the tags ! ?> <?php echo($content_head_title); ?> requestedTags) ? [] : $contentManager->requestedTags); include 'commons/DOM/sidebar.php'; ?>

hasError) { echo(''); echo(localize("content.header.base")); echo(''); echo(''); echo(localize("content.error.header")); echo(''); } elseif($contentManager->displayType == EContentDisplayType::SEARCH) { echo(''); echo(localize("content.header.base")); echo(''); echo(''); echo(localize("content.search.header")); echo(''); } elseif($contentManager->displayType == EContentDisplayType::DISPLAY) { echo(''); echo(localize("content.header.base")); echo(''); echo(''); echo('' . $content->get_head_title() . ''); echo(''); } ?>

displayType == EContentDisplayType::SEARCH) { printMainHeader(localize("content.error.heading.main.search"), "fad fa-exclamation-triangle"); } elseif($contentManager->displayType == EContentDisplayType::DISPLAY) { printMainHeader(localize("content.error.heading.main.content"), "fad fa-exclamation-triangle"); } else { printMainHeader(localize("content.error.heading.main.fallback"), "fad fa-exclamation-triangle"); } echo('

' . $content_error_message . '

'); goto content_printing_end; } if($contentManager->displayType == EContentDisplayType::SEARCH) { // We are handling a content search with at least one result. // Making the header with the amount of results. printMainHeader( count($contentManager->rootIndexEntries) > 1 ? localize("content.search.heading.main.multiple") : localize("content.search.heading.main.single"), "fad fa-file-search", count($contentManager->rootIndexEntries) . " " . ( count($contentManager->rootIndexEntries) > 1 ? localize("content.search.count.multiple") : localize("content.search.count.single"))); // Printing the entry for each piece of relevant content. $doPrintRuler = false; foreach($contentManager->rootIndexEntries as $current_content) { /** @var ContentIndexEntry $current_content */ if($doPrintRuler) { echo('
'); } else { $doPrintRuler = true; } echo('
'); echo('id).'">'); echo('
'); echo(''); echo('

' . $current_content->title[$user_language] . '

'); echo('

' . $current_content->preamble[$user_language] . '

'); echo('
'); echo('
'); echo('

'); foreach($current_content->tags as $current_content_tag) { echo('#' . $current_content_tag . ''); } echo('

'); echo('
'); } // TODO: Print the tags used in the search and others that may be available. } elseif($contentManager->displayType == EContentDisplayType::DISPLAY) { // Printing the content echo($content->get_html()); } // Label used when there is an error to skip the content printing parts. content_printing_end: ?>
"); } ?>