SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 37 of 37
  1. #26
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't that typical. Small mistake, messing with everything.

    Glad you got it working. [img]images/smilies/smile.gif[/img]

    -Helge

  2. #27
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now I just can't figure out how to get rid of (or change) the link to the first non excistant post. If you go to <edited away> you will see at the top of the list a link with --:// and if you go to the firts post that is properlie posted you can see the same thing. Looks like a link to self with subject, poster, time, and date removed. It's not in the book in any of the pictures.
    Last edited by reptilianfeline; Apr 29, 2003 at 03:23.
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  3. #28
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're sure that there's no empty entry in the db, I would suggest that you do some errorchecking on the function/page making the post index.
    There should be a loop printing all the results from the db. Try to see if the first iteration there is empty.

    It's a shot in the dark, but maybe I'm lucky

    -Helge

  4. #29
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I can tell, the problem is in this function:
    PHP Code:
    function display_tree($expanded$row 0$start 0)
    {
        global 
    $table_width;
        echo 
    "<table width=\"$table_width\">";
        
        if (
    $start>0)
            
    $sublist true;
        else
            
    $sublist false;
            
        
    $tree = new treenode($start''''''1true, -1$expanded$sublist); //Think this is what makes the link
        
        
    $tree->display($row$sublist);
        
        echo 
    '</table>';

    I tried to remove the line I marked in the script and recieved a fatal error.
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  5. #30
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another shot in the dark...

    Try to set the $row = 1 instead of $row = 0.
    PHP Code:
    function display_tree($expanded$row 1$start 0
    It's hard to see what's going on because the class treenode is beeing used recusive and the display method is also beeing used recusive. And the lack of documentation isn't making it any better.

    -Helge

  6. #31
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't seem to matter...

    This book is driving me nuts. Half of the files are only on the CD, and the explanations are really hard to find. Maybe that particular thing has been explained earlier in the book, but I just can't find it.

    Here is a part of the text:
    When we construct the root treenode from display_tree() from the main page, we are actually creating a dummy node with no article associated with it. We pass in some initial values:
    PHP Code:
    $tree = new treenode($start''''''1true, -1$expanded$sublist); 
    This creates a root node with a $postid of zero. This can be used to find all the first-level postings because they have a parent of zero. We set the depth to -1 because this node isn't actually part of the diplay. All first-level postings will have a depth of zero, and be at the far left of the sceen. Subsequent depths step towards the right.
    Maybe they got their depths confused?

    Oh... here is the function that creates the treenodes.
    PHP Code:
    function treenode ($postid$title$poster$posted$children$expand$depth$expanded$sublist)
        {
            
    $this->m_postid $postid;
            
    $this->m_title $title;
            
    $this->m_poster $poster;
            
    $this->m_posted $posted;
            
    $this->m_children $children;
            
    $this->m_childlist = array();
            
    $this->m_depth $depth;
            
            if ((
    $sublist||$expand) && $children)
            {
                
    $conn db_connect();
                
                
    $query "select * from header where parent = $postid order by posted";
                
    $result mysql_query($query) or die (mysql_error());
                
                for (
    $count=0$row = @mysql_fetch_array($result); $count++)
                {
                    if (
    $sublist||$expanded $row['postid'] ] == true)
                        
    $expand true;
                    else
                        
    $expand false;
                    
    $this->m_childlist[$count]= new treenode ($row['postid'],$row['title'],
                                                            
    $row['poster'],$row['posted'],
                                                            
    $row['children'], $expand,
                                                            
    $depth+1$expanded$sublist);
                }
            }
        } 
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  7. #32
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by reptilianfeline
    Maybe they got their depths confused?
    Maybe try changing it to 0 or 1.

    I'm sorry I'm not providing any quality help here now. I don't have the guts, today, to try to understand that code fully. I'm sorry.
    Maybe you could contact the author/publisher and ask them.

    -Helge

  8. #33
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well... I've found a couple of things that doesn't seem to add up.

    In one place it says $depth+1. I can understand that. It's to make sure that the depth isn't zero, right?
    Next place to remove the diplay of that first level it says $depth-1. So I figure they first add one, and then remove it to do some work with the first level.
    And then we have that dummy tree node where they set depth to -1. I'm confused.

    I'll try setting the dummy node to zero and see what happens.
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  9. #34
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dummy node depth set to zero or 1, no luck. Arrgh!!!
    Maybe I need another + or -?

    This is the line in the display function that makes sure that an emtpy root node isn't displayed.
    PHP Code:
    if ($this->m_depth>-1
    m_depth comes from the treenode function I posted earlier. What does the line really do?
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  10. #35
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well... I copy and pasted one portion at a time from the original treenode-class, and got it to work. I then made the HTML inside better, so I can make it compliant when I integrate it with my site. I'm not sure exactly where the error was. Probably just something tiny and easily overlooked.

    Now I'm going to customize the look and feel and add smilie support
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...

  11. #36
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's good, because I was running out of ideas of what was causing the trouble.

    Glad you sorted it out.

    -Helge

  12. #37
    Kitty Lizard reptilianfeline's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere in Cyberspace
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did learn a lot from it. You gave me a couple of ideas on troubleshooting as well, so I am better prepaired next time
    Reptilian Feline
    | www.reptilian-feline.net | Art | Tutorials | Pets | Music |
    Webdesign the hard way...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •