Does JRoute by default finds path to menu link (SEF)

by user1876234   Last Updated November 07, 2018 15:10 PM

What do I understand in Joomla is that until you create menu for specific view you will be getting component links to it's views, in this manner:

component/component_name/location/new-york (ex #1)

If you create link for this view it should transform to menu alias + view + item name or id, like this:

/locations/location/new-york (ex #2)

However I did this and I'm still getting old link like in example #1. Though if I add Itemid to the link I get expected result like in example #2, see below what I mean:

JRoute::_('index.php?option=com_modern_tours&view=location&alias=' . $asset->alias .'&Itemid=138'); this transforms to this /locations/location/new-york

But this

JRoute::_('index.php?option=com_modern_tours&view=location&alias=' . $asset->alias); this transforms to this component/component_name/location/new-york

Seems like in this case I have to created additional function to search through menu and add missing itemid. Though I'm unsure if this is really how it should work, or Joomla itself should take of this ? Can someone explain this to me please

Tags : url sef joomla3.8


Related Questions


Updated April 29, 2015 23:04 PM

Updated April 08, 2016 08:04 AM

Updated October 27, 2017 12:10 PM

Updated October 11, 2017 18:10 PM

Updated October 19, 2017 06:10 AM