I am writing a module which has articles. I'd like these article to finish using the "find out moreInch button. This button should redirect to some menuitem pointing fully article if this type of menuitem is available, in order to the content (as with component=com_content&id=... etc.) if this isn't the situation.
At this time I am using JRoute using the id:
$url = JRoute::_( 'index.php?option=com_content&view=article&id='.$article->id )
but this returns the next url:
$url = "http://example.com/option=com_content&view=article&id=1"
This points towards the correct article, however is not search-engine friendly (it's on, with .htaccess support) Also it creates a different page than my menuitem pointing towards the article.
I am sure it needs to make a move with JRoute however i aren't able to find any resource how to make this happen.
Any ideas? Thanks!
Use the ComponentHelperRoute:
$link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid))