Y
Y
Yuri Yerusalimsky2016-03-16 21:56:34
CMS
Yuri Yerusalimsky, 2016-03-16 21:56:34

How to make CMS Joomla display tags component URL (com_tags) in an adequate way?

For example, now I have started to actively use the SEF Wizard plugin , but it only removes the ID from the URL string. Internal SEF is also included. As a result, when I select an article tag, I follow a link like: site.ru component /tags/ tag /text.html, and I would like to see something like site.ru/tags/text.html. Is it somehow possible to force SEF to process, or rather, hide in this case in the URL the parts of the link highlighted in bold? Not necessarily just such a result, I would like, in principle, to get something more adequate than a link in this case.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Yerusalimsky, 2016-03-17
@werber

In short, a temporary solution out of my head is ( AHTUNG! BYDLOKOD! ):
Since I didn’t want site.ru/component/tags/tag/text.html , but site.ru/tegi/text.html , I ended up doing the following:
1. Created a menu item "Tags" (hence the tegi in the url, but that suits me too), this menu item on the site was hidden via CSS ( #menu ul li.item-xxx{display:none}).
2. I wrote a simple php function, which I pushed into the index.php of the template ( tested on Joomla 3.4.8 ):

function URLRedirect($url_part){
  if (strstr(JURI::current(),JURI::base().$url_part)){
    $length = strlen(JURI::current());
    $last_pos = strrpos(JURI::current(),"/")+1;
    $word = substr(JURI::current(),$last_pos,($length-$last_pos));
    $new_url = JURI::base()."tegi/".$word;
    header("Location:".$new_url);
  }
}

3. Called the function in the index.php of the template at the very beginning in the following way:
As a result, the function looks for the presence in the URL of this page of the mention of the tags component. If such a mention is found, it gets the name of the page itself (xxx.html) and replaces site.ru/component/tags/tag... with site.ru/tegi... + the page name. As a result, we get our perverted version of the redirect. Yes, once again I repeat, I understand that this is bydlokod, I am aware of this. I just can’t write more elegantly yet, I don’t have such skills and experience. If it will be useful to someone = use it to your health. In addition, my technique can be thought out for other similar problems. I would be especially grateful if someone has the time and desire to think out my code, maybe I didn’t take something into account.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question