使 Joomla 组件与 SEF/SEO 兼容

发布于 2024-09-11 02:06:38 字数 112 浏览 2 评论 0原文

您好,我为 Joomla 1.5 开发了一个自定义组件。然而,打开 SEF 时的 url 看起来可能会更好一点,例如显示标题而不是 id,当打开 Joomla 的 SEF 时,如何为我的组件制作自定义 url?

Hi I have developed a custom component for Joomla 1.5. However the urls when SEF is turned on could look a bit better e.g. display the title rather than the id, how can I make custom urls for my component when SEF for Joomla is turned on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你对谁都笑 2024-09-18 02:06:39

您可以按如下方式使用 JRoute 类:

JRoute::_( $url, $xhtml = true, $ssl=null );

$url 是一个包含绝对或相对内部 Joomla! 的字符串。网址。

$xhtml 是一个布尔值,指定输出是否应采用 XHTML。该参数是可选的,如果省略则默认为 true。

$ssl 是一个整数值,指定 URI 是否应该安全。应将其设置为 1 以使用全局安全站点 URI 强制 URI 安全,设置为 0 使其保持与传递时相同的状态,设置 -1 以使用全局不安全站点 URI 强制 URI 不安全。

最重要的参数是$url。对此方法的调用可能如下所示:

JRoute::_( 'index.php?view=article&id='.$[itemID] );

You Can use JRoute class as follows:

JRoute::_( $url, $xhtml = true, $ssl=null );

$url is a string containing the absolute or relative internal Joomla! URL.

$xhtml is a boolean value that specifies whether or not the output should be in XHTML. This parameter is optional and if omitted defaults to true.

$ssl is an integer value that specifies whether the URI should be secure. It should be set to 1 to force the URI to be secure using the global secure site URI, 0 to leave it in the same state as when it was passed, and -1 to force the URI to be unsecure using the global unsecure site URI.

The most important parameter is $url. A call to this method might look like:

JRoute::_( 'index.php?view=article&id='.$[itemID] );
初见 2024-09-18 02:06:38

您研究过 Joomla 路由方法吗? http://docs.joomla.org/Routing

Have you looked in to the Joomla routing methods? http://docs.joomla.org/Routing

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文