API16:JTableNested/setLocation
From Joomla! Documentation
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