Joomla 组件的 URL
我在 joomla 中创建了一个简单的基本组件,名为 Careerform,所以我想知道它的 url 是什么?会是 :
index.php/?option=com_careerform
还是在 sef 中会是这样的: index.php/components/careerform
或者使用 .htaccess 时会像这样 /careerform
这是真的吗?不同设置的 joomla 默认 URL 是什么?请说说你所知道的。
感谢您抽出时间。
I have created a simple basic component in joomla named, careerform so I want to know that what will be its url? Will it be :
index.php/?option=com_careerform
or in sef it will be something like:index.php/components/careerform
or it will be like this while using .htaccess/careerform
Is it true or what are joomla default URLs with different settings? Please tell what you know.
thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然您要求做的事情是可能的,但重命名组件会相当复杂。作为重命名的一部分,您将必须更新组件的每个文件中的数十个(如果不是数百个)类的名称。因此很可能会遇到一些错误。
更容易的前景是在您的网站中避免使用这些类型的网址。仅当视图不存在菜单项时,Joomla 才会回退到该样式的 url。因此,您可以将网址设置为:
http://sitename.com/any-component- alias/
为此,请进入菜单管理器并创建一个新的菜单项。如果您不希望将其作为主菜单的一部分,您可以创建一个新菜单。 (我通常有一个名为“隐藏”的菜单,用于我想要别名的菜单项,但实际上并不从菜单链接到整个站点。)创建菜单项时,请确保类型与组件和视图匹配。别名将是标题下方别名框中输入的任何内容。
您可能遇到的一个问题是组件可能没有特定视图的菜单类型。在这种情况下,您需要将必要的metadata.xml 文件添加到视图中(这比重命名组件要容易得多!)。可以在这里找到一个很好的教程:http://docs.joomla.org/Adding_view_layout_configuration_parameters。
While what you are asking to do is possible, it would be rather complicated to rename a component. As part of the renaming you would have to update the names of dozens if not hundreds of classes throughout every file of the component. Very likely to run into some bugs because of this.
The far easier prospect is to just avoid these types of urls in your site. Joomla will only fall back to that style of url if a menu item does not exist for the view. Because of that, you can make the url into this:
http://sitename.com/any-component-alias/
To do this, go into the menu manager and create a new menu item. If you don't want this as part of the main menu, you can create a new menu. (I typically have a menu called "Hidden" for menu items that I want aliased but don't actually link to throughout the site from a menu.) When creating the menu item, make sure the type matches the component and view. The alias will then be whatever is entered in the alias box just below the title.
The one issue you may run into with this is that a component may not have a menu type for a particular view. In that case, you you would need to add the necessary metadata.xml file to the view (which again would be much easier than renaming the component!). A good tutorial for that can be found here: http://docs.joomla.org/Adding_view_layout_configuration_parameters.
是的,如果启用 SEF,则将使用
index.php/component/careerform
。yes if SEF will be enabled then
index.php/component/careerform
will be used.您可以通过为组件开发路由器来创建自定义 URL。
这里有非常好的文档。
You can create custom URLs by developing a router for your component.
There is very good documentation for it here.