Actions

JURI/setPort

From Joomla! Documentation

Revision as of 17:05, 16 September 2008 by Chris Davenport (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sets the port number part of the URI represented by the JURI object.

Syntax

void setPort( $port )

where:

Argument Data type Description Default
$port integer Port number to be added to the URI. This will replace any existing port number.

Example

In this example, a URI object is created and the port is then changed.

$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthis';
$u =& JURI::getInstance( $uri );
echo 'Before: ' . $u->toString() . "\n";
$u->setPort( 8081 );
echo 'After : ' . $u->toString();

would output

Before: http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthat
After : http://fredbloggs:itsasecret@www.example.com:8081/path/to/Joomla/index.php?task=view&id=32#anchorthat

See also