2

Can anybody shed some light how to generate an url in Joomla command-line application.

Seems that budget was cut off at Joomla routing development because:

JRoute::_('index.php?option=com_mycomponent&view=document&tmpl=component');

results in:

cli/component/mycomponent/?view=document&tmpl=component

Via web it is:

/et/component/mycomponent/?view=document&tmpl=component

Or am I missing something?

Edit:

I could obtain hostname from JUri::base() after I had set live_site in configuration (weird property name considering that there exists also site_url).

3
  • Are you saying the same call to jroute in the site application produced a different url? Could you perhaps add some more details to your question. Apr 13, 2018 at 11:23
  • Sorry, my question was little bit wrong (edited). Via web the result is /et/component/mycomponent/?view=document&tmpl=component. Via command line the result is cli/component/mycomponent/?view=document&tmpl=component (notice no leading slash and incorrect locale).
    – JohnSmith
    Apr 13, 2018 at 11:50
  • Am experiencing similar, though in my case, I simply get the 'cli' prefix on my URls for command-line use, and not for web. I have no equivalent of your '/et'.
    – John Rix
    Apr 25, 2018 at 0:08

1 Answer 1

1

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 results in similar URLs containing /administrator/ even if a frontend URL is generated:

https://github.com/joomla/joomla-cms/issues/20070

The release lead of Joomla answered there something like that this (maybe) is something which can not get fixed in J!3.8 as a alternate solution he wrote:

helper method that parses and removes the /administrator segment.

Probably this could also be a temporarily solution to remove/replace your 'cli' with 'et'. Not sexy, but if your issue is related to that broken Router issue there seems no other clean way to do right now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.