如何在 joomla 中创建指向文章的链接? [英] How to create a link to an article in joomla?

查看:18
本文介绍了如何在 joomla 中创建指向文章的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站包含一些图标,我希望每个图标都指向一篇文章的链接,我已经创建了这些文章,我想在不创建菜单项的情况下显示它们.我试图这样做:
icon1 的 Href -> 第 1 条
icon2 的 Href -> 第 2 条
...但是我的目标页面只显示文章的文本,没有滑块和网站的主菜单.
什么对我有用:
我创建了一个名为 hidden with menu items 的菜单,我将每个菜单项与我想要的文章相匹配,然后在我的 href 图标中添加了文章的链接.
菜单项 1 -> hidden/item1 并且我选择了文章 1
菜单项 2 -> hidden/item2 并且我选择了第 2 条.

My website contains some icons, I want that each icon point to a link to an article, I have already create those articles, I want to show them without creating menu items. I tried to do that :
Href of icon1 -> Article 1
Href of icon2 -> Article 2
... But my target page show only the text of the article, without the slider and the main menu of the website.
What works for me :
I have created a menu called hidden with menu items, I matched each menu item with the article that I want, then I added the link of the article in my href's icon.
Menu item 1 -> hidden/item1 and I selected Article 1
Menu item 2 -> hidden/item2 and I selected Article 2.

谢谢.

推荐答案

如果要保留所需的模块,则需要指定一个菜单项.这是因为您想要控制哪些模块应该与哪些文章一起显示,因为模块是由菜单项分配的.如果没有指定目的菜单项,那么将显示错误的模块或根本没有模块.

If you want to keep the desired modules, you need to specify a menu item. This is because you want to have control over what modules should be displayed with what articles, as modules are assigned by menu items. If there is no menu-item specified by purpose, then the wrong modules will be displayed or no modules at all.

因此,实现此目的的最佳方法是为您的每篇文章创建一个单独的菜单和相应的菜单项.您可以将此菜单命名为隐藏",因为您不想创建模块并将其显示在前端.然后您可以将您的图标链接到每篇文章,包括 url 中的菜单项 ID:网址示例:

So, best way to achieve this is to create a separate menu and the respective menu items for each of your articles. You can name this menu as "Hidden", since you will not want to create a module and display it at the front-end. Then you can link your icons to each article including the menu item id in the url: Example of the url:

index.php?option=com_content&view=article&id=1&Itemid=100

如果您的图标位于自定义 html 模块中,那么我建议使用 JCE 编辑器的链接管理器来链接到您的菜单项/文章.

If your icons are inside a custom html module, then I would suggest to use the link manager of the JCE editor to link to your menu items/articles.

如果您从模板内部进行链接,那么您可能希望使用 JRoute() 创建链接,以确保启用 SEF 网址...

If you are linking from inside your template, then you might want to use the JRoute() to create the link, to ensure SEF urls if you enable them...

因此链接的代码如下所示:

So the code for the link would look like:

<a href="<?php echo JRoute::_('index.php?option=com_content&view=article&id=1&Itemid=100'); ?>">Link</a>

这篇关于如何在 joomla 中创建指向文章的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆