Hot answers tagged

4 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 ...
user avatar
  • 8,581
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 ...
user avatar
3 votes

Problem with JRoute::_ and ajax data

The final source code is: // Get menu item $app = JFactory::getApplication(); $menu = $app->getMenu(); // Get component's name $comName = JFactory::getApplication()->input->get('option'); /...
user avatar
  • 7,415
3 votes
Accepted

Paginated links on items generated using a custom search module does not work

I think I see the issue with the search module form destination url. The form action attribute needs the option and view parameters. I see you added them as hidden field at the end of the form, ...
user avatar
  • 1,396
3 votes

Using JRoute in the backend? Almost figured it out, help needed

Here is how I ended up getting it to work: $live_site = substr(JURI::root(), 0, -1); $app = JApplication::getInstance('site'); $router = &$app->getRouter(); $url = $router->build($...
user avatar
  • 131
3 votes

Using JRoute in the backend? Almost figured it out, help needed

JRoute is not reliable on the backend. Your approach may work on a simple install, but if you have a third-party SEF plugin, or even some slightly unorhodox routing in third-party components, this ...
user avatar
3 votes
Accepted

Compose URL from its parts

You can use php method http_build_query to generate url encoded query string. Club all the different parameters in an array and pass it to this method. Like $base_url = 'index.php?'; $parameter = ...
user avatar
  • 1,791
3 votes
Accepted

Is this a route loop?

We made this problem go away by updating Joomla to 2.5.24 (a painless point-release upgrade) and updating Document Seller to its 3.5 version, and the problem described above resolved itself exactly as ...
user avatar
  • 151
2 votes

404 HTTP codes in Joomla

You can customize the 404 error (example show a custom page or send somewhere other than the homepage) by adding a PHP file to your template, name it error.php and place it in the root of the template ...
user avatar
  • 855
2 votes
Accepted

404 HTTP codes in Joomla

This isn't an error but expected behavior. If you navigate to Components > Redirect in the Joomla Administrator's interface, you will see a list of all URLs requests resulting in a 404. Joomla ...
user avatar
  • 1,396
2 votes
Accepted

How to remove IDs from SEF URL in Joomla?

I found the solution with the help of @Farahmand, here it is: <?php defined('_JEXEC') or die; function empresaBuildRoute(&$query) //Esta función divide la url y se trae las variables. { $...
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-&...
user avatar
  • 19.5k
2 votes

How to change url scheme of Search component?

Try this Goto joomla administrator -> System -> Global configuration -> Here you can enable the sef url and check your url.
user avatar
  • 338
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 ...
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:...
user avatar
  • 1,478
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 ...
user avatar
  • 374
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 ...
user avatar
  • 8,581
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 ...
user avatar
  • 802
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 ...
user avatar
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 ...
user avatar
  • 26.5k
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'])) ...
user avatar
  • 2,971
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 ...
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 ...
user avatar
  • 1,737
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&...
user avatar
  • 2,971
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 = ...
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: ...
user avatar
  • 1,120
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);
user avatar
  • 131
1 vote
Accepted

SEF URL using router without id in the URL

You can use .htaccess URL Rewrite replacing the numeric segment to something else but you have to make sure your item's alias column is unique in your component's table unless the same URL segments ...
user avatar
  • 166
1 vote
Accepted

Component doesn't use route Joomla 2.5.28

It is Ok to create hidden menu items for better content managament. But, you have to be sure that Itemid is associated with generated Urls. It is not so obvious how to associate Itemid. Each ...
user avatar
  • 7,415
1 vote

How to change url scheme of Search component?

Solved the problem by creating a hidden menu for Search component. Here is the link which i followed https://docs.joomla.org/Search_Engine_Friendly_URLs
user avatar
  • 325

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