API16

JTableNested/setLocation

< 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

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


Advertisement