Actions

API15

JURI/toString

From Joomla! Documentation

< API15:JURI
Revision as of 17:19, 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 full uri string

[Edit Descripton]

Description:JURI/toString

Syntax

toString($parts=array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'))
Parameter Name Default Value Description
$parts array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment') $parts An array specifying the parts to render

Returns

string The rendered URI string

Defined in

libraries/joomla/environment/uri.php

Importing

jimport( 'joomla.environment.uri' );

Source Body

function toString($parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'))
{
        $query = $this->getQuery(); //make sure the query is created
 
        $uri = '';
        $uri .= in_array('scheme', $parts)  ? (!empty($this->_scheme) ? $this->_scheme.'://' : '') : '';
        $uri .= in_array('user', $parts)        ? $this->_user : '';
        $uri .= in_array('pass', $parts)        ? (!empty ($this->_pass) ? ':' : '') .$this->_pass. (!empty ($this->_user) ? '@' : '') : '';
        $uri .= in_array('host', $parts)        ? $this->_host : '';
        $uri .= in_array('port', $parts)        ? (!empty ($this->_port) ? ':' : '').$this->_port : '';
        $uri .= in_array('path', $parts)        ? $this->_path : '';
        $uri .= in_array('query', $parts)       ? (!empty ($query) ? '?'.$query : '') : '';
        $uri .= in_array('fragment', $parts)? (!empty ($this->_fragment) ? '#'.$this->_fragment : '') : '';
 
        return $uri;
}

[Edit See Also] SeeAlso:JURI/toString

Examples

<CodeExamplesForm />