API16

JTableNested/setLocation

From Joomla! Documentation

< API16:JTableNested

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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[edit]

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[edit]

boolean True on success.

Defined in[edit]

libraries/joomla/database/tablenested.php

Importing[edit]

jimport( 'joomla.database.tablenested' );

Source Body[edit]

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[edit]

Code Examples[edit]