The cUriBuilder allows to create URIs to CONTENIDO articles i.e. frontend URIs. Usually these URIs look like front_content.php?lang=<lang>&idart=<idart>
. The cUriBuilder allows for totally different URIs e.g. SEO-URIs that contain names of categories and articles instead of the strange looking URI mentioned above. In order to create these URIs independant of the chosen strategy for URI creation it is a good idea to use the cUriBuilder whose will be explained in this article.
Create an URI
The easiest way to create a link to an arbitray article is as follows:
$url = cUri::getInstance()->build(array( 'lang' => $lang, 'idart' => $idart ));
If you like to create a link to the current article you can use this snippet instead:
$url = cUri::getInstance()->build(array( 'lang' => cRegistry::getLanguageId(), 'idart' => cRegistry::getArticleId() ));
Die URI-Klassen mit dem cUriBuilder sind u.a. dafür da, Links für das Frontend zu generieren. Die unterschiedlichen Klassen und deren Verwendungszwecke sowie beispielhafte Implementationen sollen verdeutlichen, wie ein Link generiert werden und beeinflusst werden kann.