JRoute/
Aus Joomla! Dokumentation
< JRoute(Weitergeleitet von Joomla! Programmierung/Framework/JRoute/)
Konvertiert einen normalen Joomla! Link zu einem SEO Link
Inhaltsverzeichnis |
[Bearbeiten] Syntax
public static function _($url, [$xhtml = true], [$ssl = null])
| Datentyp | Parameter | Beschreibung |
|---|---|---|
| string | $url | Absoluter oder relativer Joomla! Link. |
| boolean | [$xhtml = true] | Ersetzt & mit & für XHTML Kompatibilität. |
| integer | [$ssl = null] | Erzeugt je nach Parameter eine sichere Verbindung:
|
[Bearbeiten] Beispiele
echo JRoute::_('index.php?option=com_content&id=32-joomla-nafu&Itemid=5');
Die Ausgabe kann sehr variieren, je nach Verlinkung und Position im Menu. Es könnte ähnlich wie hier aussehen:
http://www.joomla.org/texte/32-joomla-nafu.html
[Bearbeiten] Quellcode
{ // Get the router. $router = $app->getRouter(); // Make sure that we have our router if (!$router) { return null; } { return $url; } // Build route. $uri = $router->build($url); // Replace spaces. /* * Get the secure/unsecure URLs. * * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over * https and need to set our secure URL to the current request URL, if not, and the scheme is * 'http', then we need to do a quick string manipulation to switch schemes. */ if ((int) $ssl) { // Get additional parts. if (!$prefix) { } // Determine which scheme we want. $scheme = ((int) $ssl === 1) ? 'https' : 'http'; // Make sure our URL path begins with a slash. { $url = '/' . $url; } // Build the URL. $url = $scheme . '://' . $prefix . $url; } if ($xhtml) { } return $url; }
[Bearbeiten] Siehe auch
- JRoute::_() auf api.joomla.org
- JRouter
- JURI