Joomla文档中文翻译 - 什么是jdoc声明

joomla_documentation_168今次又是一篇知识补完,就着前面几篇关于Module Chrome的文档,现将jodc的单篇也排到这里。

jdoc声明是Joomla模板的一个方法(method),用来在页面中输出指定的内容。典型的jdoc声明看上去是这样的: <jdoc:include type="component" />。不同类型(type)的jdoc声明负责不同的内容输出

Component

<jdoc:include type="component" />

这个声明要放在模板的<body></body>中,并且只能出现一次;它负责输出当前页面的主要内容(main content)。

Head

<jdoc:include type="head" />

这个声明要放在模板的<head></head>中,并且只能出现一次;它负责输出当前页面的样式表链接、脚本链接、meta信息等内容。

Installation

<jdoc:include type="installation" />

这个类型的jdoc声明只用于Joomla的安装器模板(Installer template)中,与Component类型相似,它只负责输出安装过程中页面上的主要内容。

Message

<jdoc:include type="message" />

message声明要放在模板的<body></body>中,并且只能出现一次,用于输出操作过程中的系统提示信息或出错信息。

Module

<jdoc:include type="module" name="breadcrumbs" />
<jdoc:include type="module" name="menu" />
<jdoc:include type="module" name="submenu" style="rounded" id="submenu-box" />

module类型的jdoc声明会根据其name属性输出对应的模块,但该模块内容是否会呈现在页面上则取决于用户是否发布激活了该模块;我们可以为其设定style属性来控制模块输出模式;可参见“Joomla文档中文翻译 - 原生模块结构(module chrome)类型及对应的HTML输出”。

Modules

modules类型的jdoc声明用来在当前位置调用某个模板位置(template position)的所有模块;所有的模板位置都需要预先在templatedetails.xml文件中定义。我们同样可以为其设定style属性来控制模块的输出模式。下面是是一些Joomla模板中常见的modules类型的jdoc声明:

<jdoc:include type="modules" name="debug" />
<jdoc:include type="modules" name="icon" />
<jdoc:include type="modules" name="left" style="rounded" />
<jdoc:include type="modules" name="left" style="xhtml" />
<jdoc:include type="modules" name="right" style="xhtml" />
<jdoc:include type="modules" name="status" />
<jdoc:include type="modules" name="syndicate" />
<jdoc:include type="modules" name="title" />
<jdoc:include type="modules" name="toolbar" />
<jdoc:include type="modules" name="top" />
<jdoc:include type="modules" name="top" style="xhtml" />
<jdoc:include type="modules" name="user1" style="xhtml" />
<jdoc:include type="modules" name="user2" style="xhtml" />
<jdoc:include type="modules" name="user3" />
<jdoc:include type="modules" name="user4" />

另外,关于模块输出,可以参见“Joomla文档中文翻译 - 怎样在模板中自定义模块结构(module chrome)”以了解更多模块输出自定义方面的信息。

译者:Viiiix7210

如需转载,请注明官方英文文档及本人译文的出处,谢谢。查看官方英文文档: jdoc statements


收藏与分享

评论刷新

2010-03-30 12:01
很好。
2010-03-30 20:39
谢谢
2010-05-27 17:51
感谢博主,最近在学这个,本人英 语水平着实一般,官方文档看得我 一头雾水,幸亏找到了你的blo g,真是太感谢了!
2010-05-27 20:28
用的上就好,共同学习的

添加评论


Security code
换一张图