How should the lft and rgt columns be set?

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
YGETARTS
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Fri May 13, 2011 10:26 pm

How should the lft and rgt columns be set?

Post by YGETARTS » Wed May 18, 2011 4:00 pm

Sorry for another post. I'm importing articles and each article belongs to a category. I'm not able to get the categories to work, however, and it appears to be due to my 'lft' and 'rgt' columns in my 'categories' table not being properly set. Any insight into how they work? I've been googling and can't find anything. Thanks.

Schip
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jun 08, 2011 11:01 pm

Re: How should the lft and rgt columns be set?

Post by Schip » Thu Jun 09, 2011 9:34 am

look for nested lists

Paul

jabbott777
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Tue Jan 26, 2010 10:37 pm

Re: How should the lft and rgt columns be set?

Post by jabbott777 » Tue Nov 22, 2011 12:12 am

I have figured out that it refers to nested list stuff too. But how is it I would determine a set of numbers for a component I am building and manually entering into the menu on my development box?

Schip
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jun 08, 2011 11:01 pm

Re: How should the lft and rgt columns be set?

Post by Schip » Tue Nov 22, 2011 11:00 pm

Hi Jabbott,

the theory is available on wikipedia: http://en.wikipedia.org/wiki/Nested_set_model If you would like to enter it manually, you will have to change the values of the parent nodes as well. Write it out and key it in.

I think the better solution would be to run a script to rebuild the tree structure. Since 1.6 there is a class and method available: http://docs.joomla.org/JTableNested::rebuild/11.1

Here's a script that can be used to rebuild the usergroups in 1.5:
http://forum.joomla.org/viewtopic.php?p=1577433

Paul

tukanglibas
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Sat Nov 03, 2007 8:16 am

Re: How should the lft and rgt columns be set?

Post by tukanglibas » Wed Nov 30, 2011 7:20 am

I have an external script that imports our data into Joomla categories.

How do I invoke the JTableNested::rebuild from my external script ?
I guess in more generic words, how do I use Joomla API in my external script ?

Regards,
William.

User avatar
stan31337
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Thu Jul 31, 2008 8:30 am
Location: Marmaris, Turkiye
Contact:

Re: How should the lft and rgt columns be set?

Post by stan31337 » Fri Mar 23, 2012 6:49 am

Hello!
How to call JTableNested::rebuild in a custom component's model?

revnoah
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Jul 15, 2015 1:39 pm
Location: Saint John, New Brunswick, Canada

Re: How should the lft and rgt columns be set?

Post by revnoah » Wed Jul 15, 2015 5:04 pm

That would be some helpful information.

jonBuckner1
Joomla! Explorer
Joomla! Explorer
Posts: 420
Joined: Mon Nov 12, 2012 9:08 am

Re: How should the lft and rgt columns be set?

Post by jonBuckner1 » Tue Dec 15, 2015 8:56 pm

Hi,

I'm another one looking for an answer....

This might help some of you:
http://joomla.stackexchange.com/questio ... -component

Thanks

jonBuckner1
Joomla! Explorer
Joomla! Explorer
Posts: 420
Joined: Mon Nov 12, 2012 9:08 am

Re: How should the lft and rgt columns be set?

Post by jonBuckner1 » Sun Dec 20, 2015 2:38 pm

Hi folks

Here is an example I use successfully with Seblod. This is not Seblod code, exclusively Joomla!'s

Code: Select all

// http://joomla.stackexchange.com/questions/5104/programmatically-add-menu-item-in-component
// sorts out the lft rgt issue

$menuTable = JTableNested::getInstance('Menu');

// which menu you want to add to - 
$menutype = 'thisismymenusname';

// this is heading menu item but what data you have and require will vary per case - just look at an appropriate row in yr menu table
$menuData = array(
  'menutype' => $menutype,
  'title' => $table->alias,
  'alias' => $table->alias,
  'path' => $table->alias,
  'type' => 'heading',
  'component_id' => 0,                  
  'language' => '*',
  'published' => 1,
);

// this item is at the root so the parent id needs to be 1
$parent_id = 1;
$menuTable->setLocation($parent_id, 'last-child');

// save is the shortcut method for bind, check and store
if (!$menuTable->save($menuData))
{
  $this->setError($menuTable->getError());
  return false;
}
Jon

yugtia
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Mar 09, 2016 5:14 am

Re: How should the lft and rgt columns be set?

Post by yugtia » Wed Mar 09, 2016 5:32 am

Hi,

Go for this.. May be it will work for you..
http://bj.zemplate.com/protostar-respon ... ht-columns

Thank you
Last edited by pe7er on Wed Mar 09, 2016 6:38 am, edited 1 time in total.
Reason: Manual signature has been removed

jonBuckner1
Joomla! Explorer
Joomla! Explorer
Posts: 420
Joined: Mon Nov 12, 2012 9:08 am

Re: How should the lft and rgt columns be set?

Post by jonBuckner1 » Wed Mar 09, 2016 7:44 am

Hi yugtia

The left (lft) and right (rgt) columns you refer to are to do with the template and how it gets rendered, using conditional statement to determine the column widths for left, right, and content columns.

This post is referring to the lft and rgt columns in the database for menu items

Jon


Locked

Return to “Joomla! 2.5 Coding”