ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Nested Set library (aka MPTT, aka Hierarchy DB Trees)

October 01, 2008 2:58am

Subscribe [19]
  • #31 / Dec 31, 2012 4:09am

    CroNiX

    4713 posts

    Did you try the one from the first post in this thread?

  • #32 / Dec 31, 2012 8:13am

    extractortotem

    4 posts

    first post in this thread says only lft, rgt, and parent.
    but here: http://datamapper.wanwizard.eu/pages/extensions/nestedsets.html
    it says: left, right, root, name, value.
    in the source code datamapper/nestedset.php in class DMZ_Nestedsets there are the following: $_leftindex, $_rightindex, $_rootfield and $_nodename (without symlink things).

    so, I’m a little bit confused. Maybe it’s two different things? I mean this documentation here http://datamapper.wanwizard.eu/pages/extensions/nestedsets.html is maybe not for the latest downloadable version here: http://datamapper.wanwizard.eu/pages/download.html ?

    Or what am I misunderstanding?

    I’m a beginner in CI but this is somewhat crazy that I get only error messages all the time. It would be awesome to have a tutorial for absolute beginners about Datamapper ORM nestedset library.
    Maybe it’s not compatible with the newest version of CI? (...extends Controller <> ...extends CI_Controller…? The other strange thing is, however I have set up nestedset, NetBeans don’t suggest functions, and I get error messages when I would like to use one…. for example the first thing is a Tree() what I’m not able to call. I don’t know…)

    how can I check why is this nestedset extension is not loaded? or where should I start searching for a solution?

    Thanks!
    regards,
    ET

  • #33 / Jan 04, 2013 2:03pm

    extractortotem

    4 posts

    Hi,

    at last… I managed to make it work. and it is really stupid simple. however I still believe that the documentation is confusing and a tutorial would be useful for absolute beginners. only a very little cleanup and additional info would be enough not to become completely confused as a beginner.
    the only thing that bothers me is that Netbeans doesn’t pop up possible methods of nestedset. Can this be somehow fixed?

    and as far I as I see “level” is not updated automatically. do I have to make it manually all the time?

    thanks a lot!

  • #34 / Jan 05, 2013 9:25pm

    CroNiX

    4713 posts

    I think the problem is that 2 different libraries were discussed in this thread that both use MPTT.  The datamapper that you are referring to is not the same as was discussed in the first post.  So I think that’s where your confusion is coming from.

  • #35 / Jun 03, 2014 8:29am

    predte4a

    1 posts

    Just a heads-up - check the code of this library before using it, cause you can get a bad surprise from some methods. For example, the method

    public function checkNodeIsChild($testNode, $controlNode) {
            return ($testNode[$this->parent_column_name] == $controlNode[$this->primary_key_column_name]);
        }

    This method will return TRUE ONLY IF the $testNode is a direct child of the $controlNode. If it is down the tree more than one level, the method will return FALSE while the test node is still a child of the control.
    From my point of view this method should look like this:

    public function checkNodeIsChild($testNode, $controlNode) {
            return ($testNode[$this->left_column_name]>$controlNode[$this->left_column_name] 
                && $testNode[$this->right_column_name]<$controlNode[$this->right_column_name]);
        }

     

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases