url : supplied url to be processed
path : supplied url to be compared
pointer : navigation pointer or icon (accepts html tags)
$url = new UrlMapper;
setbase() and map().
These are explained below:
map() method is used to map urls. It divides each section of a url link
to a clickable link.
$url->map($url, $pointer);
where:
$url: url to be sectionalized
$pointer: navigation pointer
$mapped = $url->map('index/user', '<span class="bi-chevron-right"></span>');
var_dump($mapped);
<a href="index">index</a>
<span class="bi-chevron-right"></span>
<a href="index/user">user</a>
index while the final url of the last link
generated is index/user. The icon supplied as pointer is also
used as the resolved links separator. Using the bootstrap
library, the link will finally resemble the format below on web pages
index user
setbase() method is used to apply a prefix to generated urls.
When defined, the value supplied will be added at the beginning of all generated url.
$url->setbase('http::/localhost/app'); // supplies a prefix to all mapped urls
$mapped = $url->map('index/user', '<span class="bi-chevron-right"></span>');
var_dump($mapped);
<a href="http://localhost/app/index">index</a>
<span class="bi-chevron-right"></span>
<a href="http://localhost/app/index/user">user</a>
Window root class has a built-in static method map() for mapping urls. The window class
handles the setbase() part of the Urlmapper class and just applying the
directive self::map() urls can be easily mapped. This provides an easy navigation system.