JURI/setFragment
From Joomla! Documentation
Sets the fragment part of the URI represented by the JURI object.
Syntax
void setFragment( $anchor )
where:
| Argument | Data type | Description | Default |
|---|---|---|---|
| $anchor | string | Fragment to be added to the URI. This will replace any existing fragment. |
Example
In this example, a URI object is created and a fragment is added to it.
$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32'; $u =& JURI::getInstance( $uri ); echo 'Before: ' . $u->toString() . "\n"; $u->setFragment( 'anchorthat' ); echo 'After : ' . $u->toString();
would output
Before: http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32 After : http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthat