I am wishing to extend 1 particular function (uri_string) in the URL HELPER.
Have very limited experience in extending something from the core so hoping for some guidance.
Essentially I would like to extend the function to accept a parameter which should provide a MAXIMUM number of segments to return.
This would ensure a maximum of 3 segments get returned.
Suppose these examples:
demo.com/admin returns admin
demo.com/admin/pages/add/1/2/3 returns admin/pages/add
Finally if no parameter is given the function would behave as it currently does in the core.
Can anyone help?
My only thinking so far is I should be doing a php explode and then return a string that has been reconstructed somehow with the maximum number of segments (or all segments if $max == NULL).