Joomla get a good url article

I am new to Joomla and trying to develop a module for 3.1. I managed to get the selected article identifier and title in the module parameters, but I don’t know how to get the identifier URL, something similar to get_permalink (ID) in Wordpress.

+4
source share
1 answer

You want to run the URL through JRoute to get the full URL. You also need to know how Joomla articles are usually created.

$url = JRoute::_('index.php?option=com_content&view=article&id='.$id); 

This assumes you have id in the variable $id . For the rest of the URL, you will need to find out the component that you are calling (added as an option, as mentioned above, the Content manager is always com_content ) and the view (which is for the article article ). You can view the various views available for com_content by checking the file structure in /components/com_content/views/ . In addition to article , you should see articles , categories and category , as well as several others.

+4
source

Source: https://habr.com/ru/post/1494474/


All Articles