Actions

API16

JURI/root

From Joomla! Documentation

< API16:JURI
Revision as of 17:46, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Returns the root URI for the request.

[Edit Descripton]

Description:JURI/root

Syntax

static root($pathonly=false, $path=null)
Parameter Name Default Value Description
$pathonly false $pathonly If false, prepend the scheme, host and port information. Default is false..
$path null

Returns

string The root URI string.

Defined in

libraries/joomla/environment/uri.php

Importing

jimport( 'joomla.environment.uri' );

Source Body

public static function root($pathonly = false, $path = null)
{
        static $root;
 
        // Get the scheme
        if (!isset($root))
        {
                $uri                    = &JURI::getInstance(JURI::base());
                $root['prefix'] = $uri->toString(array('scheme', 'host', 'port'));
                $root['path']   = rtrim($uri->toString(array('path')), '/\\');
        }
 
        // Get the scheme
        if (isset($path)) {
                $root['path']   = $path;
        }
 
        return $pathonly === false ? $root['prefix'].$root['path'].'/' : $root['path'];
}

[Edit See Also] SeeAlso:JURI/root

Examples

<CodeExamplesForm />