WebsiteBaker 2.13.9 R22 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php page_content(1); ?>
header('Content-Type: text/xml');date_default_timezone_set('Europe/Berlin');$time_now = time();ob_start();show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());ob_end_clean();echo '<'.'?xml version="1.0" encoding="UTF-8"'.'?'.'>'."\n";echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";for ($i=0; $i<(count($array_menus)-1); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end forecho '</urlset>'."\n";
<?php header("Content-type: text/xml");echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; ?><?php page_content(); ?>
date_default_timezone_set('Europe/Berlin');$time_now = time();ob_start();show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());ob_end_clean();echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";for ($i=0; $i<(count($array_menus)-1); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end forecho '</urlset>'."\n";
<?xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://argeforum.de</loc><lastmod>2023-02-04</lastmod><changefreq>weekly</changefreq></url>...</urlset>
throw new \Exception('malformed document created, missing head area');
//
die Leerzeile ist noch da (steht nur woanders).
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; ?>
echo '</urlset>'."\n";
Ich erinnere mich, ich musste in der WB Installationsdatei eine Zeile auskommentieren. Sonst bricht die Ausgabe von XML mit Fehlermeldung ab.Ich habe in der Datei: /modules/output_filter/Filters/filterCssToHead.php die Zeile: #67 Code: [Select]throw new \Exception('malformed document created, missing head area'); mit Code: [Select]// auskommentiert. WB prüft die Ausgabe, das war meine einzige Möglichkeit selbst zu bestimmen was ausgeliefert wird.
<html> <head> </head> <body> </body></html>
eine normale Reaktion, wenn man vom Standard abweicht. WB prüft mit genanntem Filter die HTML-Kompatibilität, in der es z.b. heißt: die Struktur ist
Allein dieses Schema passt nicht, von Rest red ich garnicht.
Grundsätzliche Frage, mache ich das so falsch? Ich spiel ungern an den Installationsfiles rum.
Gibt es eine andere herangehensweise um XML oder RSS auszugeben und dabei die Prüfroutinen von WB nicht zu stressen?
Vielleicht sollten WB Entscheider berücksichtigen, dass nicht nur HTML ausgegeben wird.
$sAfterContent = ($bPrintAnchor ? '</div><!-- INFO '.$module.$section_id.' -->' : ''); // echo $sContent = $sBeforeContent."\n".$sContent."\n".$sAfterContent."\n"; echo $sContent = \ltrim($sBeforeContent."\n".$sContent."\n".$sAfterContent."\n", "\n");
function readNewsPosting($in_reverse_count=1) {// Diese Funktion liest die letzten (in_reverse_count) News aus der Datenbank// Rückgabe als Arrayglobal $database;$out = array();$cnt = 0;$sql_command = "SELECT title, content_short, link, published_when FROM ".TABLE_PREFIX."mod_news_posts";$sql_command .= " WHERE active = 1 ORDER BY posted_when DESC";$sql_command .= " LIMIT ".$in_reverse_count;$get_db = $database->query($sql_command);$db_found = $get_db->numRows();if ($db_found > 0) {while ($db = $get_db->fetchRow()) { $out[$cnt]["name"] = $db["title"]; $out[$cnt]["desc"] = $db["content_short"]; $out[$cnt]["link"] = WB_URL.PAGES_DIRECTORY.$db["link"].'.php'; $out[$cnt]["time"] = $db["published_when"]; $cnt++;} // end while} // end if db_foundreturn $out;} // end function// *** MAIN *************************************************************date_default_timezone_set('Europe/Berlin');$time_now = time();echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";// MENU1ob_start();show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());$array_menus_removed = array_pop($array_menus); // das letzte Element aus Menus war immer leer (deswegen fliegt es raus)$array_posts = readNewsPosting(20);ob_end_clean();// Basemenüsfor ($i=0; $i<(count($array_menus)); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end for// News Postingsfor ($i=0; $i<(count($array_posts)); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_posts[$i]["link"].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end for// MENU2ob_start();show_menu2(2, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());ob_end_clean();for ($i=0; $i<(count($array_menus)-1); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end forecho '</urlset>'."\n";
function readNewsPosting($in_reverse_count=1) {// Diese Funktion liest die letzten (in_reverse_count) News aus der Datenbank -> Rückgabe als Arrayglobal $database;$out = array();$sql_command = "SELECT title, content_short, link, published_when FROM ".TABLE_PREFIX."mod_news_posts";$sql_command .= " WHERE active = 1 ORDER BY posted_when DESC";$sql_command .= " LIMIT ".$in_reverse_count;$get_db = $database->query($sql_command);$db_found = $get_db->numRows();if ($db_found > 0) {while ($db = $get_db->fetchRow()) { $temp_array = array(); $temp_array["name"] = $db["title"]; $temp_array["desc"] = $db["content_short"]; $temp_array["link"] = WB_URL.PAGES_DIRECTORY.$db["link"].'.php'; $temp_array["time"] = $db["published_when"]; $out[] = $temp_array;} // end while} // end if db_foundreturn $out;} // end function// *** MAIN *************************************************************date_default_timezone_set('Europe/Berlin');$time_now = time();echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";// URLS AUS MENU #1ob_start();show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());$array_menus_removed = array_pop($array_menus); // das letzte Element aus Menus war immer leer (deswegen fliegt es raus)$array_posts = readNewsPosting(20);ob_end_clean();for ($i=0; $i<(count($array_menus)); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end for// URLS AUS NEWS-POSTINGSfor ($i=0; $i<(count($array_posts)); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_posts[$i]["link"].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end for// URLS AUS MENU #2ob_start();show_menu2(2, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[url];', '', '', '', false, false);$array_menus = explode(";", ob_get_contents());ob_end_clean();for ($i=0; $i<(count($array_menus)-1); $i++) { echo '<url>'."\n"; echo '<loc>'.$array_menus[$i].'</loc>'."\n"; echo '<lastmod>'.date("Y-m-d", $time_now).'</lastmod>'."\n"; echo '<changefreq>'.'weekly'.'</changefreq>'."\n"; echo '</url>'."\n";} // end forecho '</urlset>';
<?php header("Content-type: text/xml");echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"."\n"; ?><?php page_content(); ?>
<?xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://argeforum.de</loc><lastmod>2023-02-09</lastmod><changefreq>weekly</changefreq></url>...</urlset>*** LEERZEILE 1****** LEERZEILE 2***
</footer></body></html>
<section id="content">...<hr><p style="margin-top: 20px;">Seite ausgeliefert am 09.02.2023 20:56 Uhr - Europe/Berlin (CET)</p>*** LEERZEILE 1****** LEERZEILE 2***</section>
Ich weiß: CSS-Styles im Quellcode sind hässlich, das sind nur Tests
Die ominösen 2 Leerzeilen kommen auch dort. Nur eben woanders, wo der Inhalt aus dem CMS geladen wurde.
echo $sContent = \ltrim($sBeforeContent."\n".$sContent."\n".$sAfterContent."\n", "\n");
echo $sContent = \trim($sBeforeContent."\n".$sContent."\n".$sAfterContent."\n", "\n");
echo $sContent = $sBeforeContent.$sContent.$sAfterContent;
if (!empty($sContent) && $isActive) { $bPrintAnchor = ($bAnchor && ($sSectionIdPrefix == 'none')||($sSectionIdPrefix != 'none')); $sAnchor = "\n".'<div id="'.$sSectionIdPrefix.$section_id.'" class="section m-'.$module.' '.$sAttribute.'" >'; $sBeforeContent = ($bPrintAnchor ? $sAnchor : ''); $sAfterContent = ($bPrintAnchor ? '</div><!-- INFO '.$module.$section_id.' -->' : ''); // echo $sContent = $sBeforeContent."\n".$sContent."\n".$sAfterContent."\n"; echo $sContent = \ltrim($sBeforeContent."\n".$sContent."\n".$sAfterContent."\n", "\n"); }