API16

API16:JTableNested/setLocation

From Joomla! Documentation

Revision as of 22:43, 22 March 2010 by Doxiki (talk | contribs) (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 ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

[Edit Descripton]

Template:Description:JTableNested/setLocation

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;
}

[Edit See Also] Template:SeeAlso:JTableNested/setLocation

Examples

<CodeExamplesForm />