定義模組位置

From Joomla! Documentation

This page is a translated version of the page Declaring module positions and the translation is 88% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎български • ‎русский • ‎中文(台灣)‎

templateDetails.xml 檔案中含有所有模板的安裝以及核心資訊。要模組管理器提共一個位置給模組使用,這個位置必須在 templateDetails.xml 檔案中宣告。

在 templateDetails.xml 中的模組元素

In the file, the sub-element <positions> along with its sub-elements <position> define the locations available for each module position supported by the template. Here is a brief list of the commonly used names for the various module positions and how they are declared.

<positions>
  <position>top</position>
  <position>left</position>
  <position>right</position>		
  <position>bottom</position>
  <position>banner</position>
  <position>syndicate</position>
  <position>footer</position>
  <position>user1</position>
  <position>user2</position>
  <position>user3</position>
  <position>user4</position>
  <position>debug</position>
</positions>

通過這些比較常用的使用方法,讓模板開發者可以同時選擇模組位置名稱以及固的跟隨樣式

The addition of module positions, as displayed above, is implemented in between the <positions> and </positions> tags. In between those tags in the templateDetails.xml file, add the name of the module position in between a set of <position> and </position> tags.

你可以新增,並且宣告新的模組位置,然後給予它任何你喜歡的名稱,但是建議還是照著之前所給的例子為範本。這樣可以在換模板或者在同一個網站裡用多個模板的時候,能保持某個水平的穩定性。

宣告及使用

Joomlaǃ 的模板會將那些新增於用 <jdoc:include /> 定義的特定位置的模組顯示出來,定義方式如下:

<jdoc:include type="modules" name="name of module position" style="xhtml" />

更多關於 <jdoc:include /> 的資訊、程式碼以及如何使用,請看 jdoc statements

推薦話題