I need some help for this script, because i get Errors while checking the document as XHTML 1.0 Transitional:
Quote
-
Line 934, Column 4: document type does not allow element "ul" here; assuming missing "li" start-tag <ul> ✉ -
Line 956, Column 5: end tag for "li" omitted, but OMITTAG NO was specified </ul> ✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">". -
Line 934: start tag was here ><ul>
The reason is lying in <li>-Tags, which are closed by this script to early. The link list is shown by way of example:
# <ul>
# <li><a href='Link1'>Link1</a>: Text1</li>
# <li><a href='Link2'>Link2</a>: Text2</li>
-> # <li><a href='DirLink'>DirLink</a>: Directory</li>
# <ul>
# <li><a href='Link3'>Link3</a>: Text1</li>
# <li><a href='Link4'>Link4</a>: Text2</li>
# </ul>
# </ul>
The <li> of the DirLink should be open until the second list is closed.
And with more interlacings (deeper structure) i get more errors.
Perhaps its interesting, that I've modified the Snippet in that way [ $url = $etomite->makeURL($child['id']) ] that it shows friendly URLs:
// --------------------
// Snippet: Basierend auf ContentListing
// --------------------
// Version: 1.0 Beta
// Date: December 28th, 2005
// philip@haeusler-av.de
//
// Rekursive Abtastung der Verzeichnisstruktur.
//
// Anpassung am 24.06.2009
// Liv Christiane Göhner
//
//
// Benutzung:
// [[ContentListing?id=0]]
//
$content = "<h3>Some text... as heading</h3>";
function getContent($id, $etomite) { //Das ist die Rekursive Funktion
$children = $etomite->getActiveChildren($id,'pagetitle','ASC','id, pagetitle, description, isfolder');
$output = "<ul>"; //Ebene erzeugen (Einrueckung)
foreach ($children as $child) { //Fuer jedes Unterobjekt, das uebergeben wurde
if ($child['isfolder']==0) { //wird ueberprueft, ob dieses ein ordner ist.
$url = $etomite->makeURL($child['id']);
$output .= "<li>"; //wenn es ein Dokument ist, erfolgt diese Ausgabe:
$output .= "<a href='".$url."'>".$child['pagetitle']."</a>";
if ($child['description']!="") {
$output .= ":
".$child['description']; // ist die Beschreibung leer oder gleich dem Titel, dann nicht.
} //klappt aber leider noch nicht ganz :'(
$output .="</li>";
} else { //Wenn es ein Ordner ist, dann wird Folgendes ausgegeben:
$url = $etomite->makeURL($child['id']);
$output .= "<li>";
$output .= "<a href='".$url."'>".$child['pagetitle']."</a>";
if ($child['description']!="") {
$output .= " - ".$child['description'];
}
$output .= "</li>";
$output .= getContent($child['id'], $etomite); //Hier der rekursive Funktionsaufruf.
//Der rekursiven Funktion werden die Kinder des Ordners uebermittelt.
}
}
$output .= "</ul>"; //Diese Ebene (Einrueckung) beenden.
return $output; //Zur Rueckgabe des Generierten Baums an die untere Ebene.
}
$content .= getContent($id, $etomite); //Aufruf der rekursiven Funktion mit den Unterdokumenten der
// uebergebenen $id.
//Das $etomite muss uebergeben werden, damit die rekursive Funktion darauf zugreifen kann.
return $content; //Ausgabe
How can the script be modified, that it works in the right way and passes test?
Thanks for assistance.
Edited by Christiane, 08 July 2009 - 01:04 PM.