Fehler mit der SiteMap
Verfasst: Do 9. Jun 2005, 03:44
Hallo, ich habe eine SiteMap gefunden, die mir sehr zusagt. Es handelt sich um die Sitemap die für XHTML angepasst wurde. Es funktioniert, und wird dargestellt. Nur tauchen zwei Probleme auf.
1 Problem: Im Error Log wird immer nach dem Aufruf der SiteMap ein Bericht eingetragen.
2 Problem: Der alleerster Punkt der Seitmap, verweist auf eine Falsche CMSseite. So das ich natürlich immer ein Error bekomme.
Hoffe mir kann jemand bei diesem Problem helfen.
1 Problem: Im Error Log wird immer nach dem Aufruf der SiteMap ein Bericht eingetragen.
2 Problem: Der alleerster Punkt der Seitmap, verweist auf eine Falsche CMSseite. So das ich natürlich immer ein Error bekomme.
Hoffe mir kann jemand bei diesem Problem helfen.
Code: Alles auswählen
[02-Jun-2005 03:51:33] MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND level <= 2 AND C.visible=1 ORDER by A.idtree' at line 1
SELECT * FROM cms_cat_tree AS A, cms_cat AS B, cms_cat_lang AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND C.idlang='1' AND B.idclient='1' AND B.parentid = AND level <= 2 AND C.visible=1 ORDER by A.idtree
[02-Jun-2005 03:51:33] next_record called with no query pending.
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
* Modulname : Sitemap
* Author(s) : Nik Wyss
* Copyright : None
* Created : 14-01-2003
* Modified : 14-01-2003
* Modified : 29-12-2003 by Sascha Benkart.
* - Adapt to Contenido V4.4
* - Output only shows visible items
* Modified : 05-04-2005 by Mathias Rauh - Output as <ul>
************************************************/
$amountLevel = "CMS_VALUE[1]";
$newcat = "CMS_VALUE[0]";
function sitemap($newcat=0)
{
global $lang, $client, $amountLevel, $color, $startLevel, $cfg, $lvl_alt;
$db = new DB_Contenido;
$sql = "SELECT * FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".
$cfg["tab"]["cat_lang"]." AS C ".
"WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND ".
"C.idlang='$lang' AND B.idclient='$client' AND ".
"B.parentid =$newcat AND level <= $amountLevel AND C.visible=1 ".
"ORDER by A.idtree";
$db->query($sql);
$result = "";
while ($db->next_record())
{
$lvl = $db->f("level");
if ($lvl > $startLevel && $lvl != $lvl_alt) $result .= "<ul>\n"; //bei niedrigerem Level neue Liste beginnen
if ($lvl == $startLevel) $listyle = " style=\"font-weight:bold;\"";
$result .= "<a id='link' href=\"index.php?idcat=".$db->f("idcat")."\"><li id='no'".$listyle.">".$db->f("name")."</li></a>\n".sitemap($db->f("idcat"));
if ($lvl < $lvl_alt) $result.= "</ul>\n"; //bei höherem Level Liste beenden
$lvl_alt = $lvl; // Level merken
} // end while
return($result);
}
$sql = "SELECT level FROM {$cfg["tab"]["cat_tree"]} WHERE idcat=$newcat";
$db->query($sql);
$db->next_record();
$startLevel = $db->f("level");
if ($startLevel == "") { // für ALLE KATEGORIEN
$startLevel = "0";
}
else {
$startLevel = $startLevel+1;
}
$lvl_alt = $startLevel;
$amountLevel += $startLevel;
if ($newcat==0) $amountLevel--;
echo "<ul>\n".sitemap($newcat)."</ul>";
?>