![]() |
MPTtree, Hieararchical trees in a database table - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: MPTtree, Hieararchical trees in a database table (/showthread.php?tid=6842) |
MPTtree, Hieararchical trees in a database table - El Forum - 11-17-2009 [eluser]Unknown[/eluser] [quote author="nardanadam" date="1258495169"]m4rw3r, your solution requires update of 'order' columns of data, when an insert operation is processed. Do you think it really fits for this situation?[/quote] Nested sets model implies updating when inserting new records, it is a normal situation. Say when you want to insert a new item between two existing ones with adjacent (lft, rgt) ranges (e. g. (10, 20) and (21, 30)), you will have to update the range boundaries of the rightmost item and all items to the right of it. It's like inserting a new node into an XML file: when you do it, all subsequent tags (even those that do not define direct ancestors, siblings or descendants of the node being inserted) are being shifted several lines down. This can be mitigated to some extent by reserving some extra space when inserting new records (making lft and rgt more sparse). MPTtree, Hieararchical trees in a database table - El Forum - 03-17-2010 [eluser]sqwk[/eluser] Small Bug: On line 745 of mpttree.php (model) Code: $this->db->select('title'); should be Code: $this->db->select($this->title_col); MPTtree, Hieararchical trees in a database table - El Forum - 06-09-2010 [eluser]Unknown[/eluser] m4rw3r you have done a good job. I a`m beginner, and I really can`t understand how to build such menu +Root |--Main Category 1 | |--Subcat 1 | |--Subcat 2 | | |--Sub-subcat 1 | | |--Sub-subcat 2 | |--Subcat 3 |--Main Category 2 | |--Subcat 4 | |--Subcat 5 | |--Sub-subcat 3 |--Main Category 3 |--Main Category 4 | |--Subcat 6 | |--Subcat 7 What have I do with the functions written by crises??? Would I have to add one of them(function category) to your controller wiki??? and others to the mpttree model??? Thanks for your answer and your work... MPTtree, Hieararchical trees in a database table - El Forum - 01-13-2011 [eluser]Gamesh[/eluser] there is a bug on PHP 5.3 Code: function debug_message(&$message){ strings can not be passed as reference, as you are creating a string that is not stored in any variable, and this type of declaration has no meaning and doesn't save memory. this line of code gives fatal error. MPTtree, Hieararchical trees in a database table - El Forum - 03-23-2011 [eluser]Unknown[/eluser] [quote author="Gamesh" date="1294938660"]there is a bug on PHP 5.3 Code: function debug_message(&$message){ strings can not be passed as reference, as you are creating a string that is not stored in any variable, and this type of declaration has no meaning and doesn't save memory. this line of code gives fatal error.[/quote] I've deleted out this, non-working on php 5.3, debug method, changed all getwhere to get_where and library $this->db->select('title'); to $this->db->select($this->title_col); and it's working just fine for me on codeigniter 2.0 php5.3.5 MPTtree, Hieararchical trees in a database table - El Forum - 05-26-2011 [eluser]Kiddo[/eluser] hello, i'm new here and i'm also a newbie in CI. i'm interested in using your MPTtree and i would really appreciated it if you can write down some addition code in documentation on how to use it nicely, like a code how to create a tree that can list: - Root 1 -- Sub 1 --- Sub 1.1 --- Sub 1.2 -- Sub 2 -- Sub 3 - Root 2 and also if i can say, i totally can't get too well on the manual. it's really unfriendly to me. i don't have any idea on how to use the function of MPTtree on manual to fit on with my project.... again and again, thanks and sorry to bother! ^^ MPTtree, Hieararchical trees in a database table - El Forum - 05-31-2011 [eluser]jojovem[/eluser] I extracted the last version of codeigniter. Then i extracted all files included in the latest Preorder Nested Tree functions. When i tried to execute: Code: <?php I got the error: Fatal error: Class 'Model' not found in D:\Server\ci\application\models\mpttree.php on line 143 Then i changed de line 143 FROM: class MPTtree extends Model{ TO: class MPTtree extends CI_Model{ Then the error changed to: Fatal error: Call to undefined method CI_Model::model() in D:\Server\ci\application\models\mpttree.php on line 192 And this one i cant fix it. Can anybody help me? 191 function MPTtree(){ 192 parent::model(); 193 } MPTtree, Hieararchical trees in a database table - El Forum - 05-31-2011 [eluser]WanWizard[/eluser] How about Code: parent::__construct(); MPTtree, Hieararchical trees in a database table - El Forum - 05-31-2011 [eluser]jojovem[/eluser] I did that, and it temporary fixed ![]() So the problem now is this: Code: <?php Fatal error: Call to a member function query() on a non-object in D:\Server\ci\application\models\MPTtree.php on line 363 Code: 360 function lock_tree_table($aliases = array()) Im sorry, but im really having a battle on this ![]() MPTtree, Hieararchical trees in a database table - El Forum - 05-31-2011 [eluser]WanWizard[/eluser] MPTree extends CI_Model? And the call to parent::__construct() works? Is the database class loaded and properly defined? The error is that $this->db is not assigned, which happens in CI_Model through a magic method. Does MPTree define a __get() by any chance that could interfere with that? You're trying to get a 1.x library to work in 2.x, you might run into all kinds of issues... |