

'path/from/joomla/root/to/file.typ' įor example, to make a URL which points to a file picture.jpg in the Joomla images folder use: To output a URL link to a file within the Joomla instance use: Joomla uses the PHP parse-url method to parse the URL, so you need to be careful to include appropriate slashes in the URL and path. $joomla = Uri::getInstance("//$joomla->setScheme("https") current() returns the URL of the current page, minus any query string or fragment, e.g.Note that this is a static function, and you pass the URL as a string, e.g. isInternal() returns true if the URL is within the Joomla instance (including the administrator area), false otherwise.isSsl() returns true if the scheme is https, false otherwise, e.g.render() is similar to toString() in that it returns the parts of the URL you want, but as you have to pass the parts you want as a bitmask, it's preferable to use toString() instead.Will return the URL minus any query or anchor (fragment). ToString() converts the Uri to a string, and allows you to select the parts of the URL which you want, e.g. toString(array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')) : string.
Website joomla code#
In the following example code snippets, $uri refers to a Uri instance, obtained for example through $uri = Uri::getInstance(). (This is similar to the Joomla Path constants).Īs well as the methods above, the Joomla Uri provides the methods listed below. Uri::base(true) returns the string /mysite/administrator.
Website joomla plus#

What gets returned from Uri::getInstance() isn't a PHP string of the URL, but rather a Joomla Uri object, which also holds internally the various parts of the URL, and provides getter and setter methods to read or write these URL parts as shown \_/ \_/ \_/ \_/\_/ \_/ \_/ Apache or IIS) and also performs some cleaning of the URL to avoid some types of injection attacks. The advantage of using this method is that it handles any peculiarities of the webserver (e.g.
