Re: Making tree menu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, thanks for all replies guyes :)
i di this before reading them


<?
include ("db.php");
header("Content-type: text/plain");
echo "
<!DOCTYPE NETSCAPE-Bookmark-file-1>
 <!--This is an automatically generated file.
 It will be read and overwritten.
 Do Not Edit! -->
 <Title>Bookmarks</Title>
 <H1>Bookmarks</H1>\n<DL>\n";
                                                                                                                                                                        
tree(0);
                                                                                                                                                                        
function tree($parentid=0, $pdesk=""){
     $bm= new db;
     $bm->query("SELECT * from bookmarks where parentid=$parentid  order by 
parentid ");
     $bm->showErrors();
        while($bm->fetchRow()){
                $desc=$bm->record['description'];
                $link=$bm->record['link'];
                                                                                                                                                                        
                $parentid=$bm->record['parentid'];
                $id=$bm->record['id'];
                if($desc=="folder"){
                #if($parentid!=0)
                echo "</DL>\n";
                                        echo "<DT><H3 FOLDED 
ADD_DATE=\"0\">$link</H3>\n<DL>\n";
                        tree($id,$link);
                        next;
                }else{
                        echo "  <DT><A HREF=\"$link\" ADD_DATE=\"0\" 
LAST_VISIT=\"0\"  LAST_MODIFIED=\"0\">{title}</A>\n";
                }
                                                                                                                                                                        
                                                                                                                                                                        
         }
    $bm->disconnect();
}
echo "</DL>\n</DL>\n";
?>

i'm trying to generate netscape bookmark file, it works ok now, but have 
problems closing subdirectories (they should be closes with </DL> tag)


my code makes this:

<DT><H3 FOLDED ADD_DATE="0">FOLDER 1</H3>
<DL>
        <DT><A HREF="http://www.ee/"; ADD_DATE="0" LAST_VISI
T="0"  LAST_MODIFIED="0">{title}</A>
</DL>  <--- no good

<DT><H3 FOLDED ADD_DATE="0">SUBFOLDER</H3>
<DL>
        <DT><A HREF="http://slashdot.org"; ADD_DATE="0" LAST_VISI
T="0"  LAST_MODIFIED="0">{title}</A>
</DL>   <-- needs 1 more here

 but this is not correct  browser will think that SUBFOLDR is not inside of 
FOLDER1


can't figure out how to make it figure out where to close subdir


<DT><H3 FOLDED ADD_DATE="0">FOLDER 1</H3>
<DL>
<DT><A HREF="http://www.ee/"; ADD_DATE="0" LAST_VISIT="0" 
LAST_MODIFIED="0">{title}</A>
       <-- don't put </DL> here
<DT><H3 FOLDED ADD_DATE="0">SUBFOLDER</H3>
<DL>
        <DT><A HREF="http://slashdot.org"; ADD_DATE="0" LAST_VISI
T="0"  LAST_MODIFIED="0">{title}</A>
</DL>   <----- CLOSE here
</DL>   



thanks again for replies.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux