[Joomla!]如何在文章中加入模块
- 详细资料
- 分类:IT Tech
- 创建于 2011年11月04日 星期五 15:13
- 最后更新于 2011年11月04日 星期五 16:34
- COM_CONTENT_PUBLISHED_DATE_ON
- 作者:Scott
- 点击数:319
How do you put a module inside an article?
原文:http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
You will usually want to associate modules with articles in some way. The modules are allocated to module positions and the module positions appear somewhere on the Web page as determined by the template. However, it is sometimes useful to have a module actually embedded within the article.
我们有些时候需要将模块放到文章里面去,然模块往往只能加入模板所设置的模块位置(Modules Positions),因而这种方式往往受到模板的限制。不过,其实还是有个办法把模块直接加到文章里面的。
To insert a module inside an article, use the {loadposition xx}Note 1, 2 command, as follows:
将模块加入到文章,我们可以用{loadposition xx}注1, 2 指令,方法如下
- Create a module and set its position to any value that doesn't conflict with an existing template position. You can type in the position value instead of selecting it from the drop-down list. For example, use the position myposition.
建立一个模块,并任意输入一个的模存放位置,该位置应当不与当前模板位置冲突。这里你应当直接在模块位置(Position)这里输入,而不要去下拉菜单中点选。比如使用位置 myposition。 - Assign the module to the Menu Items that contain the articles that you want the module to show in. You can also just assign the module to all Menu Items.
将模块布置到所需要的菜单项中。你也可以将其布置到有菜单项。 - Edit the articles where you want this module to appear and insert the text{loadposition myposition} in the article at the place where you want the module.
编辑需要加入模块的文章,在需要添加模块的位置插入模块指令{loadposition myposition} 。
Example:
Note 1: This only works when the Content - Load Module plugin is enabled. If this plugin is disabled, the text {loadposition myposition} shows unchanged in the article.
注1:这个方法只有在 Content - Load Module 插件启用时才可以用 (该插件是默认启用)。如果插件未启用,文章中{loadposition myposition}将直接显示为文本
Note 2: { }used in this article are double byte characters to show them out in the artcle. Please change them to single byte quote when you are using.
注2: 本文所用的括号{ }为双字节符号,以让他们能正常显示,实际使用时,请将括号改为单字节符号。
Note 3: This method effective in Joomla! 1.5, 1.6 and 1.7.
注3: 此方法适用于Joomla! 1.5, 1.6 及1.7。

