Skip to main content
6 votes
Accepted

Create a link from Backend to SEF Path in Frontend

Since 3.9 there's Joomla\CMS\Router\Route::link() method which takes client (site or administrator) as first argument. $link = 'index.php?option=com_content&view=article&id=1'; echo '<a ...
Sharky's user avatar
  • 11.5k
3 votes

Create SEF URLs from a Custom Component that does not search on database

One thing is, that you're trying to create a router in the old way, it changed over time. Now router is a class. Second thing is, one of your component views have to be set as a front-page for a ...
Artur Stępień's user avatar
3 votes
Accepted

How to properly add a query parameter to my Router?

What you're doing is the proper way. The included rules are suitable for basic components, they're not meant to work for every known component. In fact, some of the core components are running into ...
Sharky's user avatar
  • 11.5k
2 votes
Accepted

Possible to associate item with itself?

I'm presuming it's the Joomla Language Switcher module which you're using to switch languages. In this case, this module has to generate the links which are behind the little flag symbols. It does ...
Robbie Jackson's user avatar
2 votes

JRoute not working - always shows the current view

You need to add your own router.php and build your own views in the build + parse methods in it. I would create a router.php file with this information: https://docs.joomla.org/J3.x:...
pe7er's user avatar
  • 2,068
2 votes
Accepted

Creating site routes from Administrator client

Corrected Response ---------------- I tried this on a Joomla 4 component which I have and it worked ok, so I reckon you should be able to get it working. That exception gets created in the ...
Robbie Jackson's user avatar
2 votes
Accepted

Absolute SEF url with JRoute

You could try this way: $itemid = 164; $application = JFactory::getApplication(); $menu = $application->getMenu(); $item = $menu->getItem( $itemid ); $link = new JURI( $item->link ); $link-&...
FFrewin's user avatar
  • 19.7k
2 votes
Accepted

How to disable Joomla routing by Article ID with any alias but use exact alias only

May not be practical for blog articles, but a fixed url can be achieved via menu items: https://docs.joomla.org/Search_Engine_Friendly_URLs#Limitations Otherwise, if I see it correctly, you have to ...
astridx's user avatar
  • 449
1 vote

Joomla custom component - router not find alias

If I'm understanding you correctly, you have 2 menuitems on your site which have links /formAlias and /listAlias, and when you form an SEF URL using Route:_() then it gives you the wrong link; is that ...
Robbie Jackson's user avatar
1 vote

How to catch Joomla\CMS\Router\Exception\RouteNotFoundException in Joomla 4.1?

In J4 exceptions can be handled by system plugins with onError event: use Joomla\CMS\Event\ErrorEvent; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Router\Exception\RouteNotFoundException; class ...
Sharky's user avatar
  • 11.5k
1 vote

What is the best way to have pages displaying articles from our custom content table in Joomla 4.1?

if you just want to use different content than the one stored in the com_content tables, why not creating a simple content plugin which replaces the content in the row before showing it? That way you ...
Carlos Cámara's user avatar
1 vote

JRoute don't make a SEF Url from the article link

Apparently, this is now the expected behavior in J4. You need to create a menu item, but it doesn't have to be a menu item for a specific article. Creating a single "List All Categories" ...
Sharky's user avatar
  • 11.5k
1 vote

JRoute don't make a SEF Url from the article link

Route::_() expects a non-SEF URL as an input. index.php/eng/?view=article&id=29:article-name-1&catid=17 is already an SEF URL, which is why Route::_() is not modifying it. A non-SEF URL would ...
Weeblr's user avatar
  • 51
1 vote
Accepted

Friendly URL for a custom component

You have to create a router for your component for JRoute::_() to do anything. See Supporting SEF URLs in your component documentation. I suggest looking specifically at Simple View-based Example ...
Sharky's user avatar
  • 11.5k
1 vote

Why do we Route url using JRoute or Route namespace? What is the purpose of routing urls?

Hard to give a precise answer without more detail, so this will be oversimplified, perhaps too much so, but I'll try. Joomla URLs natively look like someone dumped part of a can of alphabet soup on ...
Arlen's user avatar
  • 802
1 vote

What is the purpose of cloning JUri in the CMSApplication route method?

Object cloning is done so that subsequent actions on the object are applied purely to the "detached replica" (cloned object) and not the original object. By not cloning, in other words just declaring ...
mickmackusa's user avatar
  • 4,826
1 vote

Generating URL in CLI

I played a bit around with that the last hour and the way you do seems to be right. Maybe you can share all the relevant code here? This could also be related to that current Joomla! issue which ...
NickSdot's user avatar
  • 111
1 vote
Accepted

JRoute::_('index.php') no longer adds Itemid since Joomla 3.8.4

There seems to be a bug with the routing in Joomla 3.8.4 which is a known issue and is currently being discussed on Github, here: https://github.com/joomla/joomla-cms/issues/19496 I've seem ...
Lodder's user avatar
  • 26.9k
1 vote
Accepted

Joomla! 3.6.4 router.php for a custom component

You are not checking the existence of parameter name before using it. Hence PHP shows the notice message. Change your code to if(isset($query['id']) && isset($query['name'])) ...
Nagarjun's user avatar
  • 3,001
1 vote

Create SEF URLs from a Custom Component that does not search on database

My original goal was creating a alias on frontend without any link using Jroute or menu id... But after a lot of search it seems that Joomla cannot do that or if it can it may need some serious ...
user1967509's user avatar
1 vote

Create SEF URLs from a Custom Component that does not search on database

Create your URLs like this: echo JRoute::_('index.php?option=com_mycomponent&Itemid='.Itemid.'&aliasid=alias-'.$id); You will want to include the Itemid of your current menu item, makes ...
Terry Carter's user avatar
  • 1,822
1 vote

[com]BuildRoute(&$query) function is called with no $query['view'] member passed

BuildRoute function gets whatever the information you will pass to it. How you are creating your urls in your component? Like this? $url = JRoute::_('index.php?option=com_mycomponent&view=myview&...
Nagarjun's user avatar
  • 3,001
1 vote

Absolute SEF url with JRoute

UPDATE 2021 It seems that somewhere around version 3.9.7, they included a fourth parameter in this function, so now the function definition is: public static function _($url, $xhtml = true, $tls = ...
mavrosxristoforos's user avatar
1 vote

Absolute SEF url with JRoute

You can not achieve it the way you trying to because if you look at the router code: link that starts with index.php should be passed, not with http(s) The correct way to achieve routing is: ...
Alexandr's user avatar
  • 1,130
1 vote

Absolute SEF url with JRoute

You can also use proper way to get full url as: $config = JFactory::getConfig(); $mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1); echo JRoute::_('index.php?Itemid=164',false,$mode);
bharat's user avatar
  • 131

Only top scored, non community-wiki answers of a minimum length are eligible