天天看點

joomla 什麼是jdoc聲明?

jdoc聲明是Joomla模闆的一個方法(method),用來在頁面中輸出指定的内容。典型的jdoc聲明看上去是這樣的:<jdoc:include type="component"/>。不同類型(type)的jdoc聲明負責不同的内容輸出。 Component:<jdoc:include type="component"/> 這個聲明要放在模闆的<body></body>中,并且隻能出現一次;它負責輸出目前頁面的主要内容(maincontent)。 Head:<jdoc:includetype="head" /> 這個聲明要放在模闆的<head></head>中,并且隻能出現一次;它負責輸出目前頁面的樣式表連結、腳本連結、meta資訊等内容。 Installation:<jdoc:include type="installation"/> 這個類型的jdoc聲明隻用于Joomla的安裝器模闆(Installertemplate)中,與Component類型相似,它隻負責輸出安裝過程中頁面上的主要内容。 Message:<jdoc:includetype="message" /> message聲明要放在模闆的<body></body>中,并且隻能出現一次,用于輸出操作過程中的系統提示資訊或出錯資訊。 Module <jdoc:includetype="module" name="breadcrumbs" /> <jdoc:includetype="module" name="menu" /> <jdoc:includetype="module" name="submenu" style="rounded" id="submenu-box"/> module類型的jdoc聲明會根據其name屬性輸出對應的子產品,但該子產品内容是否會呈現在頁面上則取決于使用者是否釋出激活了該子產品;我們可以為其設定style屬性來控制子產品輸出模式;可參見“Joomla文檔中文翻譯- 原生子產品結構(module chrome)類型及對應的HTML輸出”。 Modules modules類型的jdoc聲明用來在目前位置調用某個模闆位置(templateposition)的所有子產品;所有的模闆位置都需要預先在templatedetails.xml檔案中定義。我們同樣可以為其設定style屬性來控制子產品的輸出模式。下面是是一些Joomla模闆中常見的modules類型的jdoc聲明: <jdoc:includetype="modules" name="debug" /> <jdoc:includetype="modules" name="icon" /> <jdoc:includetype="modules" name="left" style="rounded" /> <jdoc:includetype="modules" name="left" style="xhtml" /> <jdoc:includetype="modules" name="right" style="xhtml" /> <jdoc:includetype="modules" name="status"  /> <jdoc:includetype="modules" name="syndicate" /> <jdoc:includetype="modules" name="title" /> <jdoc:includetype="modules" name="toolbar" /> <jdoc:includetype="modules" name="top" /> <jdoc:includetype="modules" name="top" style="xhtml" /> <jdoc:includetype="modules" name="user1" style="xhtml" /> <jdoc:includetype="modules" name="user2" style="xhtml" /> <jdoc:includetype="modules" name="user3" /> <jdoc:includetype="modules" name="user4" />