JTableNested/setLocation: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node ... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location. | Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location. | ||
===Syntax=== | ===Syntax=== | ||
| Line 52: | Line 50: | ||
</source> | </source> | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=setLocation | category=setLocation | ||
category=JTableNested | category=JTableNested | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 02:12, 25 March 2017
Description
Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location.
Syntax
setLocation($referenceId, $position= 'after')
| Parameter Name | Default Value | Description |
|---|---|---|
| $referenceId | The primary key of the node to reference new location by. | |
| $position | 'after' | Location type string. ['before', 'after', 'first-child', 'last-child'] |
Returns
boolean True on success.
Defined in
libraries/joomla/database/tablenested.php
Importing
jimport( 'joomla.database.tablenested' );
Source Body
public function setLocation($referenceId, $position = 'after')
{
// Make sure the location is valid.
if (($position != 'before') && ($position != 'after') &&
($position != 'first-child') && ($position != 'last-child')) {
return false;
}
// Set the location properties.
$this->_location = $position;
$this->_location_id = $referenceId;
return true;
}
Examples
Code Examples