简体   繁体   English

如何使用Joomla类制作正确的Joomla URL

[英]How to make a correct Joomla URL using the Joomla Classes

I am busy making a Joomla! 我正在忙着做一个Joomla! component. 零件。 And know i want to link to another component. 并且知道我想链接到另一个组件。 So, as example i want to link from my component 'my_component' to 'his_component'. 因此,例如,我想从组件“ my_component”链接到“ his_component”。 Normally this is simple to do. 通常,这很容易做到。 Just make a normal link like href="?option=com_his_component". 只需建立一个正常链接,如href =“?option = com_his_component”。 But the problem is that one of my consumers uses SEO friendly URLs. 但是问题是我的一位消费者使用了SEO友好的URL。 And in that case this URL won't work. 在这种情况下,该网址将无法使用。

Does anyone know a way to this the correct way (I think with the Joomla! Api) 有谁知道正确的方法(我认为是Joomla!Api)

只需用对JRoute::_($url)的调用包装该链接即可:

$link = JRoute::_('index.php?option=com_his_component&foo=bar');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM