How can I change current Joomla URL in plugin?
For example I have a cookie set $_COOKIE['mycity']
which equals barnaul
I need to create Joomla plugin that is able to replace current URL with new one.
For example replace
http://www.myjoomlawebsite.com/about.html
with
http://www.myjoomlawebsite.com/barnaul/about.html
Right now I'm trying my best to understand how JoomFish does that... I guess I need to dig into JURI->setPath
.
Try using
JRouter::attachBuildRule()
. You should pass it a callback function which will take two arguments. The first is an instance ofJRouter
, the second is an instance ofJURI
(both passed by reference). So then, your function should check the cookie value and update the path of theJURI
instance as needed.