回首頁
第一部分 Drupal簡介
Drupal overview
A tour of Drupal fundamental concepts. If you are completely new to Drupal, start here.
Drupal的功能概念,如果你是第一次約Drupal焙糟,就從要電話開始吧诫龙。
基本概念
Content, content types, fields
內容,內容類型和字段
Build navigation with menus, toolbars
用menu和toolbar做導航
Building page layouts with content and blocks
用內容和block(區(qū)塊)建立頁面布局
Organizing content with taxonomies
用分類組織內容
用戶與權限
General concepts
基本概念
This page discusses some general concepts that will be useful as you begin to explore Drupal. For more details on these concepts you may follow the links to additional documentation.
本章我們討論一些對新手來說很有用的基本概念蛹找,如果需要更詳細的內容,英語的點連接哨坪, 打賞的優(yōu)先翻譯庸疾。呵呵
節(jié)點(內容)
Anodeis the generic term for a piece of content on your web site. Thecontent typeof the node will define what fields are included with it. Depending on the type of node, different fields will be attached, and this is known as acontent type. For example, a basicPagecontent type has attached fields such as title and body fields. Other examples of content type are:Book pagesfor use in Books,Discussion topicsin forums,Blog pagesin blogs, andNews articles.
The word "node" is not meant in the mathematical sense as part of a network.
For more useful materials on content administration in Drupal, seeResource Guide: Tools for Content Administration in Drupal.
在Drupal中的節(jié)點意思是你網(wǎng)站的一段內容。而節(jié)點的內容類型決定了內容里的字段(fields)当编。根據(jù)不同的節(jié)點届慈,其實就是內容類型拉, 決定了什么樣的字段將附加在內容里忿偷,這就是我們說的內容類型金顿。舉個例子,a basic Pages 這種內容類型的字段有title標題和body正文鲤桥,另外一些例子揍拆, 書中的書頁,論壇里的討論主題茶凳,博客里的博文嫂拴,還有新聞等等播揪。
這里的node節(jié)點不是我們猿類所常說的那個網(wǎng)絡節(jié)點哦。如果需要了解更多筒狠, 請點擊英文的鏈接剪芍, 如果想看中文就不吝打個賞吧, 寫明需要看哪段窟蓝,謝謝罪裹!
實體類型
Anentity typeis a useful abstraction to group together fields. Entity types are used to store and display data, which can be nodes (content), comments, taxonomy terms, user profiles, or something custom developed.
Read more about Entities in theEntity APIdocumentation.
一個實體類型是一組字段的有用抽象集合。實體類型一般用于存儲或顯示數(shù)據(jù)运挫,有節(jié)點內容状共,評論, 分類字谁帕,用戶資料峡继,或是些開發(fā)者定義的東東。
如果需要了解更多匈挖, 請點擊英文的鏈接碾牌, 如果想看中文就不吝打個賞吧, 寫明需要看哪段儡循,謝謝舶吗!
評論
Comments are another type of content you can have on your site (if you have enabled the core Comment module). Each comment is typically a small piece of content that a user submits, attached to a particular node. For example, each piece of discussion attached to a particular forum topic node is a comment.
評論是你網(wǎng)站上另外一種內容類型,前提是你開啟了核心自帶的文章評論功能择膝。 每個評論就像我們在百度貼吧那樣跟在文章正文后面的評論誓琼。比如,在論壇里每句短小的文字跟在原論壇主題后面的就是評論肴捉。
Drupal has a system for classifying content known astaxonomy. This is provided by the core Taxonomy module. You can define your ownvocabularies(groups oftaxonomy terms) and add terms to each vocabulary. Each vocabulary can then be attached to one or more content types, and in this way, nodes on your site can be grouped into categories, tagged, or classified in any way you choose.
Read more about this concept in thetaxonomy moduledocumentation.
Drupal有個專門用來分類內容的功能叫做分類腹侣。它是一個核心自帶的功能。你可以定義你自己的字典(分類的組)齿穗,也可以對每個字典添加術語傲隶。每個字典可以可以對應一個或者多個內容類型,這樣的話窃页,你網(wǎng)站上的節(jié)點Nodes可以按照歸類跺株,標簽,是類型腮出,或者隨便什么你需要的方法來分類帖鸦。
如果需要了解更多芝薇, 請點擊英文的鏈接胚嘲, 如果想看中文就不吝打個賞吧, 寫明需要看哪段洛二,謝謝馋劈!
用戶
A user is a type of entity which represents a real-world website user. By default, a user has a set of properties including their username, password, role, and e-mail address. However, they may also have other properties provided by other modules, and can be extended with new fields. For example, you could add a new "Link" field for a user's Twitter address.
用戶是一種代表了真是世界中網(wǎng)站用戶的實體攻锰。默認情況下,用戶有一堆屬性妓雾,除了用戶名娶吞,密碼,角色械姻,Email地址等等外妒蛇,還可以有其他的屬性,可能是被其他的模塊modules定義的楷拳,而且可以被添加绒瘦,被擴展了新的字段像街。比如, 你可以添加新的鏈接字段鏈接到用戶的Twitter賬號地址。
模塊
A module is software (code) that extends Drupal functionality. Modules fall into one of three categories:
Coremodules are those included with the main download of Drupal. These can be turned on or off without downloading additional components. Examples includeBlog, Book, Poll, orTaxonomy.
Contributedmodules are downloaded from the Modules download section of drupal.org, and installed within your Drupal installation. Examples includePanels, ViewsorMetatag.
Custommodules are modules you write yourself. This requires a thorough understanding of Drupal, PHP programming, and Drupal's API.
For a collection of useful materials about module development, seeModule Development with Drupal.
模塊可以理解成用代碼(code)開發(fā)的Drupal新功能悔叽。模塊主要被分為三種:
核心模塊Core,就是我們下好了drupal以后他自帶默認的模塊拳话。這些模塊可以被打開或者關閉漫仆,同時并不需要再額外的下載更多的組件。比如像博客坤按,預定毯欣,投票,或者分類Taxonomy臭脓。
貢獻者模塊是從Drupal官網(wǎng)上下載的仪媒,在你默認安裝drupal的時候不能被自動裝上的那些功能。如Panels模塊和Views模塊還有Metatag模塊等等谢鹊。
自定義模塊算吩,是你自己寫的模塊。這需要深入的學習和理解drupal佃扼,PHP編程偎巢,和drupal的API接口。
如果需要了解更多兼耀, 請點擊英文的鏈接压昼, 如果想看中文就不吝打個賞吧, 寫明需要看哪段瘤运,謝謝窍霞!
區(qū)域和區(qū)塊(我看大部分的Drupal書都是這樣寫的,我就這么叫了)
Pages on your Drupal site are laid out inRegions. These can include the header, footer, sidebars, and main content regions. Your theme may define additional regions.
Blocksare discrete chunks of information that are displayed in the regions of your site's pages. Blocks can take the form of static chunks of HTML or text, menus (which are for site navigation), the output from modules (e.g. hot forum topics), or dynamic listings that you've created yourself (e.g. a list of upcoming events).
Drupal網(wǎng)站的頁面布局是由區(qū)域Regions組成的拯坟。比如有頭部但金,腳部,邊欄或者主內容區(qū)域郁季。你的主題可以定義額外的區(qū)域冷溃。
而區(qū)塊blocks钱磅,是一些相互獨立的信息塊,在你的網(wǎng)站上似枕,這些區(qū)塊blocks是顯示在區(qū)域regions里面的盖淡。區(qū)塊可以是一堆寫好的靜態(tài)HTML或者是text,或者是菜單(用來導航的凿歼,我們一般就叫做導航欄拉褪迟。),也可能是一些模塊輸出的內容答憔,比如論壇最熱文章排名牵咙,也可能是你自定義的動態(tài)列表,比如一些時間記錄的菜單攀唯。
菜單
There are four standard menus in Drupal 7:
TheMainmenu is built by site administrators and displayed automatically in the page header of many themes (and if not, you can enable their blocks to display them).
Managementis the administration menu, and is presented in the Admin toolbar.
Navigationis a catch-all menu that usually contains links supplied by modules on your site.
Usermenu contains links to the User account and the logout link.
You can also create your own custom menus, and display them by enabling their blocks.
You can customize menus in several ways, such as reordering menu items by setting their “weight” or simply dragging them into place, renaming menu items, and changing the link title (the tooltip that appears when you mouse over a menu item). You can move a menu item into a different menu by editing the Parent property of the menu item.
You can also add custom menu items to a menu, from the Add menu item tab of the Menu administration screen. To create a menu item, you will need to provide the path to the content.
In all cases a menu item will only be shown to a visitor if they have the rights to view the page it links to. For example, the admin menu item is not shown to visitors who are not logged in.
在Drupal7的版本中一共有4中標準的菜單:
主菜單是網(wǎng)站管理員建立的洁桌,并且自動顯示在主頁的頭部的導航菜單,如果沒有的話侯嘀, 你也可以開啟區(qū)塊去顯示這個導航欄菜單另凌。
管理菜單是網(wǎng)站管理員使用的,顯示在admin toolbar里戒幔。
導航菜單是一攬子的菜單吠谢,一般情況下它是由你網(wǎng)站的模塊給出的。
用戶菜單包含了用戶賬戶的連接和注銷诗茎。
你當然也可以使用自己定制的菜單項工坊,并且在開啟它所在的區(qū)塊(blocks)以后, 就可以看到它了敢订。
你有許多種方法來定制menus王污,比如可以通過定義權重weight來重新為菜單項排序,或者就是簡單的通過鼠標拖動到一個你想要的順序楚午,重命名菜單的項目昭齐,更換鏈接名字,或者更換菜單項的title屬性矾柜,就是鼠標放上去顯示出一行注解一樣的小字的那個阱驾。你也可以通過修改菜單項的父類屬性從而實現(xiàn)把一個菜單里的項目移動到另外的一個項目中去。
當然你也可以增加定制的菜單到另一個菜單里怪蔑,從管理員賬號的屏幕比普通用戶的賬號看到的會多里覆。如果創(chuàng)建導航欄的話, 那你必須知道鏈接正確內容的路徑PATH缆瓣。
在項目中喧枷, 菜單里的項目只給被授權的用戶看到。比如, 如果沒有登陸的話割去, admin菜單是不能被看到的窟却。
主題
TheTheme layeris separate from the data layer, the functionality extension layer (module) and Core. Theme controls the appearance (look and feel) of your site, or how your site is displayed, including the graphic look, layout, and colors. A theme consists of one or more PHP template files that define the HTML output of your site's pages, along with one or more CSS files that define the layout, fonts, colors, and other styles.
For a collection of useful materials for themers, seeTheming and Front End Development with Drupal.
主題層昼丑,和數(shù)據(jù)層呻逆,和功能擴展層(就是模塊module)和核心是相互分離的。(MVC思想的體現(xiàn))主題控制網(wǎng)站的展現(xiàn)(視覺上的和體驗上的)咖城,或者控制你網(wǎng)站是怎么顯示的呼奢,包括圖片的顯示,布局的顯示辐董,顏色的顯示简烘。主題由一個或者多個PHP模版文件構成定枷,(在Drupal8中被更好的Twig模版實現(xiàn))這些模版定義了被輸出的HTML文件以及與HTML文件配套的CSS文件欠窒,而CSS文件定義了布局,字體型将,顏色和其他的樣式茶敏。
在Drupal的官網(wǎng)有多種主題可選缚俏, 具體看鏈接拉惊搏。
又來這句話了,反感的請忽略忧换,^_^ ? ?如果需要了解更多恬惯, 請點擊英文的鏈接, 如果想看中文就不吝打個賞吧亚茬, 寫明需要看哪段酪耳,謝謝!
視圖
Although not all sites have Views, most sites include the Views module because of the excellent tools it provides. Views allows people to choose a list of nodes or other entities and present them as pages, blocks, RSS feeds, or other formats. The main use case for views is to create dynamically updating lists of content (for example, a listing of latest news), based on properties of that content (in the case of the news listing, that the content type is “News” and sorted by publication date).
雖然 不是所有的站點都有視圖模塊,但是大部分的站點都選擇的使用視圖模塊碗暗,以至于在Drupal8中颈将,視圖模塊被默認的添加到了核心里。視圖模塊可以用來選擇節(jié)點的列表言疗,或者其他的實體并把他們展現(xiàn)成頁面晴圾,區(qū)塊,RSS種子噪奄,或者其他的任何形式死姚。視圖的主要功能是根據(jù)內容的屬性(拿新聞來舉例都毒,內容類型是新聞按照發(fā)布時間排序(很像SQL的查詢語句吧^_^))生成動態(tài)更新的內容列表 账劲,(比如金抡,最新新聞的列表)蝠猬,
數(shù)據(jù)
Drupal stores information in a database. Within this database, each type of information has its own database table. For example, the basic information about the nodes of your site are stored in the Node table, and each field stores its data in a separate table (which Drupal creates automatically). Comments and Users also have their own database tables, as do roles, permissions, and other settings.
The most common database for Drupal is MySQL. However, you can also run Drupal on other database systems, such as PostgreSQL, as well.
Drupal通過數(shù)據(jù)庫保存數(shù)據(jù)。在Drupal的數(shù)據(jù)庫里什黑, 每一種信息都有它自己的數(shù)據(jù)庫表拣凹。比如:節(jié)點的基本信息被存儲在節(jié)點表里,每個字段在另外一張表存儲它的數(shù)據(jù)徽职,而且是自動創(chuàng)建的表。評論和用戶也有他們自己的表育韩,比如規(guī)則埃叭, 權限或者其他的設置立镶。
最常使用的數(shù)據(jù)庫是MySQL。當然了缭召, 你也可以在別的SQL數(shù)據(jù)庫上正常運行drupal, 像是PostgreSQL一類的。
路徑 (備注下晓折, 先這樣叫把, 后面還 有個Router垛耳,到時候看看如何翻譯)
When you visit a URL within your Drupal site, the part of the URL after your base site address is known as thepath.
When you visit a path in your Drupal site, Drupal figures out what information should be sent to your browser by checking its list of menu items and routes. Generally, Drupal allows each module to define paths that the module will be responsible for, and when you choose to visit a particular path Drupal asks the module what should be displayed on the page.
For example, the page you are now viewing ishttp://drupal.org/node/19828, and the path is "node/19828". The module that is responsible for this path is the core Node module, so when you visit this page, Drupal lets the Node module determine what to display.
當你通過瀏覽器訪問網(wǎng)頁的時候, 那個地址欄里域名后面的就叫路徑Path哥纫。
當你訪問一個頁面時,Drupal會檢查它的菜單項menu items和路由routes。通常暑诸,Drupal允許每個模塊定義它響應哪些路徑,當你訪問的時候西采,Drupal會查詢模塊應該顯示那些內容在頁面上。
比如你在訪問這個地址http://drupal.org/node/19828 狱杰,這個地址的路徑是“node/19828”。負責這個地址的模塊是核心的節(jié)點模塊。所以當你訪問這個地址的時候千埃, drupal會讓節(jié)點模塊決定把哪些內容顯示給你谒臼。
此bootstrap非彼bootstrap,彼bootstrap是一個前端框架底哥,最著名的是它的自適應功能。
Thebootstrapis the CPU (central processing unit) of Drupal. In other interactive software environments this is sometimes called the event loop. Drupal's core is a bit like that. It sits around waiting for apathrequest, and then starts processing that request.
這個bootstrap是Drupal的CPU(中央處理單元)。在其他的軟件環(huán)境拒课,這個東西往往被稱為事件循環(huán)。Drupal的核心就有點像這個東西,(從方法上來講劝堪,確實和我們用的電腦CPU有點像)當一個路徑Path請求到達的時候,它就開始處理余境。
權限
Permissionscan be set to control what users have access to view and/or edit particular areas of a site. These permissions pertain to registered users (ie: administrators, content editors, site members) and non-registered users. Permissions can be set to be very specific and granule making for a powerful feature to use when developing a site's structure.
權限是用來定義哪些用戶可以干啥的猜拾, 比如哪些內容可以給哪些用戶看顽聂, 或者哪些內容可以給哪些用戶編輯务豺。這些權限是對應注冊用戶和非注冊用戶說的。權限可以定義的很特殊或者粒度很小奔浅,這樣它在網(wǎng)站結構建設的時候就可以發(fā)揮強大的作用。
內容舞骆,內容類型和字段
Content, content types, fields
Working with nodes, content types and fields
What is a node?
什么是節(jié)點呢总处?
All content on a Drupal website is stored and treated as "nodes". A node can be one of a number ofcontent types. A node is any piece of individual content, such as a page, user, poll, article, forum topic, or a blog entry.
在Drupal站點里所有的內容被當做是節(jié)點來存儲胧谈。節(jié)點也可以是一個內容類型。節(jié)點也可以是任何的單獨內容的一部分,像是頁面键袱,用戶,投票澜汤,文章,論壇話題刹帕,或者是博客條目。
Why nodes?
為什么用節(jié)點?
Treating all content as nodes allows the flexibility to create new types of content. It also allows you to painlessly apply new features or changes to all content of one type. Comments are not stored as nodes but are always connected to one.
把所有的內容當成是節(jié)點尉共,可以增加創(chuàng)造新內容類型的彈性。也允許你幾乎沒有痛苦的為一種內容類型添加特性杠河。評論從來都會被當成是節(jié)點來存儲柳洋,但是它總是關聯(lián)到一個節(jié)點上熊镣。
Working with nodes
使用節(jié)點
A node has several default fields. You can create custom fields and define your own content types. When you installmodules, many will include additional fields (i.e. dates, times, postal addresses, images, files, URLs, geographic geofields) and content types for you to use on your site, administered in the "Content Types" area under Structure in Drupal 7.
Let's get started:more about nodes.
一個節(jié)點有很多的字段莹捡,你可以自定義字段或者定義你自己的內容類型齿椅。當你安裝模塊的時候涣脚, 系統(tǒng)會增加很多的字段(像是日期矾麻,時間,郵寄地址胰耗,圖片,文件赠群,URL,或者是地理信息)和很多字段,在Drupal7中是在內容管理功能里設置的勾笆。
如果需要了解更多, 請點擊英文的鏈接蒲每, 如果想看中文就不吝打個賞吧, 寫明需要看哪段叮阅,謝謝!
Working with content types and fields (Drupal 7 and later)
Working with content types and fields (Drupal 6 and earlier)
Import and Export of content-types, fields, panel or views-structure
用menu和toolbar做導航
Build navigation with menus, toolbars
Working with Menus
Menus are a collection of links (menu items) used to navigate a website. The Menu module provides an interface to control and customize the powerful menu system that comes with Drupal. Menus are primarily displayed as a hierarchical list of links using Drupal's highly flexible blocks feature. Each menu automatically creates a block of the same name. By default, new menu items are placed inside a built-in menu labeled Navigation, but administrators can also create custom menus.
菜單是鏈接(菜單項)的合集勒叠,用來為網(wǎng)站導航。drupal有個菜單模塊提供了可視化的控制和編輯的強大功能。通過靈活的區(qū)塊功能飘诗,菜單可以被顯示為有層次的鏈接列表昆稿。每個菜單自動生成同名的區(qū)塊。默認情況下喳瓣,新的菜單項被放置在導航菜單氯庆,不過管理員也可以創(chuàng)建自定義的菜單。
Drupal 7
Uses
In Drupal 7, you can add, remove and rename menus and menu items/tabs. You can also configure a special block for a menu and you can specify the default menu to which new items will be added.
在drupal7里,你可以添加荒给,刪除重命名菜單和菜單項,或者菜單表例朱。你也可以為菜單配置一個特殊的區(qū)塊,你還可以設置一個默認的菜單,這樣新增的菜單項將被自動添加到里面间唉。
In many themes there are at least two menus, the Main (or primary) menu, and a secondary menu. The Main menu's links drive the main navigation structure for your site, and are often displayed prominently across the top or side of the site. The Secondary menu is often used for items like the copyright and privacy notices and are often displayed at the bottom or very top of the page in smaller text. You can specify which menus are used for the main and secondary links.
許多主題有至少兩個菜單,一個主菜單,一個輔菜單。主菜單提供主要的導航結構肠虽,經(jīng)常顯示在網(wǎng)頁的頭部或者邊欄,輔菜單一般用于版權和隱私的注釋。他們經(jīng)澈嫌可以在網(wǎng)頁的最底部或者非骋胬希靠頭部的用非常小的字體寫成捺萌。
When adding or editing site content, you can also specify the content's menu item. You can specify a default menu for the content authoring form.
當你在網(wǎng)站上發(fā)布內容的時候,你也可以定制內容的菜單項储狭。你可以定義一個默認的內容作者表單互婿。
Each default or custom menu has a corresponding block. For more information on blocks, seeWorking with Blocks.
每個默認的或者定制的菜單都有對應的區(qū)塊。
Configuration?配置
Creating a menu 創(chuàng)建菜單
Navigate to the Menus page (Structure > Menusorhttp://example.com/admin/structure/menu).導航到菜單頁辽狈。
ClickAdd menu. 單擊添加菜單
In theTitlefield, enter a title. 在標簽屬性里添加標簽慈参。
In theDescriptionfield, enter an optional description. 在描述里輸入描述內容
ClickSave. 保存
To learn how to add new menu items to the menu, read further onAdding a link to a menu. To add tabs to a menu seeCreating menu tabs.
如果需要了解更多, 請點擊英文的鏈接敬特, 如果想看中文就不吝打個賞吧合搅, 寫明需要看哪段呛哟,謝謝抡笼!
Enable the menu 開啟菜單
Assuming you plan to add nodes to your menu and not just external links, you must enable it in the content type for the node(s) that will be the target of the menu's links. It is possible to add menu links that are not enabled this way through the Menus page. If you do, you will find that certain changes cause your link to disappear from the assigned menu. Menus can be enabled on multiple content types.
假設你想添加你的節(jié)點nodes到你的菜單而且不是網(wǎng)站外部的鏈接隙姿,你必須為這些想設置到菜單里的節(jié)點開啟內容類型奈嘿。
Navigate to the content type for the node(s) (Structure > Content typeorhttp://example.com/admin/structure/types).
導航到節(jié)點的內容類型,結構-》內容類型锌奴,或者是鏈接http://example.com/admin/structure/types
Locate the content type and clickedit. 定位到內容類型單擊編輯
ChooseMenu settings. 選擇菜單設置蒸健。
Click the checkbox of the menu(s) you want to enable. 勾選菜單。
(Optional) Set theDefault parent itemto choose a default menu for the content type. 可選的操作,設置默認的父類項目深碱,為內容類型選擇一個默認的菜單
Specify the menus to use for main and secondary links 定義菜單成主菜單還是輔菜單。?
Navigate to the Menu settings page (/admin/structure/menu/settings). 菜單設置。
Specify any of the following settings: 定義以下內容
Source for the main links: The menu that will provide the "main links". In many themes, the main links are displayed at the top of the page.
主菜單的源骤肛,在許多主題里亲茅, 主菜單就是顯示在頁面頭部的那個欧募。
Source for the secondary links: The menu that will provide the "secondary links". In many themes, the secondary links are displayed at the bottom of the page.
輔菜單的源跟匆,在很多主題里, 輔菜單顯示在頁面的底部泉孩。
ClickSave configuration. 保存配置
Renaming menus 菜單改名
Navigate to the Menus page (/admin/structure/menu). 結構芜茵,菜單里
ClickEdit Menu. 點擊 編輯菜單
In theTitlefield, enter a new title. 輸入一個新的titile魄懂。
ClickSave. 保存
Note: The default menus cannot be renamed. 默認菜單不能被改名。
Removing a menu 刪除一個菜單
Navigate to the Menus page (/admin/structure/menu). 結構,菜單
ClickEdit Menu. 編輯
ClickDelete. 刪除
ClickDeleteagain to confirm. 再次點擊刪除確認怔揩。
Note: The default menus cannot be deleted. 默認菜單不能被刪除。
Expanding Menus 擴展菜單
If you have hierarchical menu items within a menu and you'd like to show the submenu items, on each parent menu item's edit page, check Show as expanded and save. This only affects the immediate children below the menu item. That is, if you have 3 levels of menu items, checking Show as expanded on the first tier items will only show the second tier items, not the third tier items. For example:
如果你有多層次的菜單項, 并且你希望顯示子菜單項,在每一個父菜單項的編輯頁面咽安,勾選擴展菜單并且保存。這個功能只對最近的子菜單項起作用喇肋。也就是說坟乾, 如果你有3層的菜單項迹辐,在第一層的只能顯示出第二層來, 第三層的不行甚侣。
First tier menu item 1 第一層菜單項1
Second tier menu item 1 (only shown if First tier menu item 1 has Show as expanded selected)第二層菜單項1
Third tier menu item 1 (only shown if Second tier menu item 1 has Show as expanded selected)第三層菜單項1
Third tier menu item 2 (only shown if Second tier menu item 1 has Show as expanded selected)第三層菜單項2
Second tier menu item 2第二層菜單項2
First tier menu item 2第一層菜單項2
First tier menu item 3第一層菜單項3
Note: The default Bartik theme might appear to not follow the "show as expanded" rule as explained above for the main menu in the header, but you can place that menu in other regions and see the expected behavior. Just note that themes can have implementations that seem to deviate from the rule.
注意:在默認的Bartik這個主題里明吩,有可能會出現(xiàn)不按照擴展菜單改顯示的樣子來顯示。但是你可以把菜單放到其他的區(qū)域中渺绒,試試看能不能看到我們希望的擴展菜單的效果贺喝。這個需要注意下的就是有的時候有些主題并不能完全按照規(guī)則來正確顯示。
Drupal 6 and earlier Drupal6和早期的版本
In Drupal 6 and earlier, themes generally provide out-of-the-box support for two menus commonly labeled "primary links" and "secondary links". These are sets of links which are usually displayed in the header or footer of each page (depending on the currently active theme). Any menu can be designated as the primary or secondary links menu via the menu settings page.
在drupal6或者早期的版本里宗兼,躏鱼。。殷绍。染苛。好吧,D7都不想用的主到, 直接看D8把茶行, 這段省了。
Configuration
On the Menu administration page, administrators can "edit" to change the title, description, parent or weight of a menu item. Under the "Enabled" column, click on the checkbox to toggle a menu item on or off. Only menu items which are enabled are displayed in the corresponding menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.
Use the "add menu" tab to submit a title for a new custom menu. Once submitted, the menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu. Under the menu name there will be links to edit or delete the menu, and a link to add new items to the menu.
Use the "add menu item" tab to create new links in either the navigation or a custom menu (such as a primary/secondary links menu). Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.
Menu administration options:
Administer menus atAdminister > Site building > Menus.
Add a menu atAdminister > Site building > Menus.
Add a menu item atAdminister > Site building > Menus > Add menu item.
Modify menu settings (in particular, to specify a menu to use for primary or secondary links) atAdminister > Site building > Menus > Settings.
Manage menu blocks atAdminister > Site building > Blocks.
Using named anchors with Menus
Menu Options and Visibility in the Content authoring form
Comparison of various drop down menus
Custom Menu Links - Enables users to create menu links.
Building page layouts with content and blocks
用內容和block(區(qū)塊)建立頁面布局
Working with blocks (content in regions)
Last updated February 3, 2016. Created on December 8, 2001.
Edited byno_angel,dags,heather,erlendoos.Log in to edit this page.
Blocksare the boxes of content (such as "User Login" or "Who's online") that can be displayed inregions(such as footer or sidebar) on your page.
區(qū)塊就是內容盒子登钥,比如用戶登錄盒子或者在線盒子畔师,區(qū)塊顯示在區(qū)域中,像是底部牧牢,或者邊欄看锉。
Blocks are made available to your site most commonly by enablingmodules. Once created, a Block can be modified to adjust its appearance, shape, size and position - or which Website pages it appears on. For example, enabling the core Poll module makes the "Most Recent Polls" block available for you to place in a region. Also note that some modules provide multiple blocks when enabled, others may not define new blocks.
區(qū)塊可用最常見的方式是開啟了某些模塊。一旦區(qū)塊被創(chuàng)建塔鳍,可以修改調整它的屬性伯铣,比如顯示,形狀轮纫,大小和位置腔寡,或者是顯示在哪些頁面。比如開啟了核心里的投票模塊掌唾,那個最近投票的區(qū)塊就生效了放前,當然了很多模塊生成不只一個的區(qū)塊, 也有的模塊并不生成任何的區(qū)塊郑兴。
If you click "Configure Block" (Drupal 7) you can go ahead and edit the contents of the block, deal with the visibility settings and even change the placement of where it is on your theme.
當你點擊配置區(qū)塊的時候你可以編輯區(qū)塊的內容犀斋,處理可視化的設置,甚至改變它在你主題的位置情连。
Blocks are placed in regions via the Block Admin pageAdminister > Site building > Blocks(Drupal 6),Dashboard > Structure > Blocks(Drupal 7).
區(qū)塊在區(qū)域內叽粹, 通過控制面板,結構,區(qū)塊來配置虫几。
Your site's theme defines the regions available. Therefore, block placement in regions is done per theme on the Block Admin page. If you have more than one theme enabled on your site blockscan be placed differently for each theme.
You can learn more about regions on theRegions in Drupal 6 and 7 themesandRegions in Drupal 5 and earlier themespages.
你的站點主題定義了區(qū)域锤灿,區(qū)塊的位置通過主題的區(qū)塊管理頁面配置。如果你有多于一個的主題辆脸, 你可以在每個主題里定義區(qū)塊的位置但校。
如果需要了解更多, 請點擊英文的鏈接啡氢, 如果想看中文就不吝打個賞吧状囱, 寫明需要看哪段,謝謝倘是!
The block management screen also lets you specify the vertical sort-order of the blocks within a theme region. In Drupal 6 or later this can be done by dragging blocks to the desired position. Prior to Drupal 6 (or when Javascript is not enabled), you do this by assigning a weight to each block. Lighter blocks (smaller weight) "float up" towards the top of the region. Heavier ones "sink down" towards the bottom of it.
區(qū)塊管理也允許在主題區(qū)域內定義垂直排序亭枷,在Drupal6以后就允許通過拖動來實現(xiàn)了,Drupal6以前搀崭,JS還沒有包含進來的時候叨粘, 你只能通過調整權重來排序, 權重低的排在上面瘤睹, 權重高的排在后面升敲。
The block management screen also provides checkboxes (depending on your version of Drupal and what modules you have enabled), as well as aconfigurelink, which takes you to the configuration screen. The checkboxes and configuration page let you customize the visibility of the block. A block's visibility depends on:
區(qū)塊管理也提供了一種選擇框,(看你Drupal的版本和你使用的模塊了轰传。)也是設置鏈接驴党, 進到設置頁面, 就可以可視化的配置區(qū)塊了获茬。一個區(qū)塊的可視化取決于:
Whether it isEnabledand assigned to a region. Disabled blocks (blocks not assigned to any region in your theme) are never shown.
區(qū)塊是否啟用別切被分配了區(qū)域鼻弧,沒有啟用,或者沒有分配給任何區(qū)域的主題是顯示不出來的锦茁。
TheThrottlecheckbox (if you have the Throttle module enabled). Throttled blocks are hidden during high server loads.
節(jié)流選擇(如果你開啟了節(jié)流模塊,)那么這個模塊在服務器負載高的時候是不可見的叉存。
Page-specific visibility settings. Individual blocks can be configured to only show/hide on certain pages. This can be a path like "about" for the [site-root]/about page, "about/*" where the asterisk is any path that starts with "about". An important exception is the frontpage: "". You can also show/hide blocks based on the result of aPHP snippet.
頁面—特殊 可視化 設置码俩。有些特殊的區(qū)塊會被設置成只顯示或者不顯示在某些頁面。
Custom visibility settings. Individual blocks can be configured so that users decide whether to show/hide certain blocks.
定制可視化設置歼捏,有些區(qū)塊可以被設置成由用戶決定是否顯示稿存。
Its function. Dynamic blocks (such as those defined by modules) may be empty on certain pages and will not be shown.
還有些區(qū)塊,(比如在某些模塊里定義的)可能是空的瞳秽, 并且不會被顯示出來 瓣履。
The block management screen also has an "Add block" link. This allows you to define a block containing content of your choice. Each administrator-defined block consists of a title, a description, and a body which can be as long as you wish; the Drupal engine will render the content of the block.
在區(qū)塊管理頁面也有個“添加區(qū)塊”的鏈接,這個功能讓你可以定義一個區(qū)塊的內容练俐,每個管理員定義的區(qū)塊有一個標題袖迎, 一個描述和一個正文組成,當然就像你想要的那樣, Drupal引擎會渲染這個區(qū)塊的內容燕锥。
You can
enable, throttle, place, and configure blocks atAdminister >> Site building >> Blocks(Drupal 6) orDashboard >> Structure >> Blocks(Drupal 7).
add a block atAdminister >> Site building >> Blocks >> Add block(Drupal 6),Dashboard >> Structure >> Blocks >> Add(Drupal 7).
Note:
If the option is not available on a new installation, go toDashboard >> Customize Dashboard >> Add more Blocks. There you can add the "Management Block" which will have the Structure option.
When working with large numbers of blocks (say, more than 100), it may be necessary to increasemax_input_varsin php.ini. Otherwise, blocks may not save in regions correctly when moved.
需要注意的是如果你的區(qū)塊非常的多辜贵, 通常是超過100個, 有可能需要在php.ini里增加 increasemax_input_varsin 這個參數(shù)归形。
Technical details for Drupal 7
Core module: Yes.
Dependencies: None.
Related Modules: Dashboard.
Permissions: Administer blocks. Also see the API docs atblock permission.
API Documentation:block.admin.inc,block.api.php,block.install,block.module,block_test.module
Template files:block-admin-display-form.tpl.php,block.tpl.php
Other files: block.info, block.css, block.js
Database tables (4): block, block_role, block_custom, cache block. Also see the API docs atblock schema.
MultiBlock - Multiple instances of a block
Nodeblock: Use nodes as blocks
如果需要了解更多托慨, 請點擊英文的鏈接, 如果想看中文就不吝打個賞吧暇榴, 寫明需要看哪段厚棵,謝謝!
Organizing content with taxonomies
用分類組織內容
Last updated February 5, 2016. Created on June 7, 2002.
Edited byhansfn,ljbalogh,kakinne,ashish_nirmohi.Log in to edit this page.
Taxonomy, a powerfulcoremodule, gives your sites use of the organizational keywords known in other systems as categories, tags, or metadata. It allows you to connect, relate and classify your website’s content. In Drupal, these terms are gathered within "vocabularies." The Taxonomy module allows you to create, manage and apply those vocabularies.
分類是一個核心自帶的一個非常強大的模塊蔼紧, 它提供了組織關鍵字的作用在其他的類似系統(tǒng)里經(jīng)常被稱為categories婆硬,tags,或者是metadata歉井,它讓你可以連接柿祈, 關聯(lián),或者歸類你網(wǎng)站的內容哩至,在Drupal里躏嚎, 所有的這些詞統(tǒng)一被稱為Vocabularies,字典菩貌,而分類模塊則允許你創(chuàng)建卢佣, 管理和生效所有的這些字典。
Drupal 7 and 8 has the ability to add taxonomy fields to vocabularies and terms.
Drupal 7和 8 都能為字典和條款添加分類字段箭阶。
Taxonomyis the practice of classifying content. It will come in handy for everything from menu and navigation schemes to view and display options.
分類是歸類內容的實踐虚茶,它遲早都會對所有的內容有用, 從菜單仇参,導航霹陡,到視圖和顯示選項。
Taxonomy can be used in workflow, to customize defined sections of your website with different themes or to display specific content based on taxonomy terms. Although taxonomy can be used in various ways, probably the most important use of taxonomy in Drupal is to relate content.
分類可以用于工作流闯睹,它可以定制你網(wǎng)站定義的部分在不同的主題都生效剿干, 或者顯示按照分類條款制定的內容。 當然了分類還可以有很多種 用法怕磨。
Taxonomy should be driven by the business requirements of your website, with an eye towards possible future functional expansion. Here are some questions to help you determine how you may want to use taxonomy:
Are there subsections of your site that you would like to look different from the main theme?
Are there content areas of your site that should be edited only by a specific part of your organization?
Is there content that can be shared around your site (such as a press release, form or fact sheet)?
Is there a business need to support local sites such as service centers or local events?
Are there different states you need to set (such as left navigation / breadcrumbs) for site sections?
Are there needs around providing default lists of content by taxonomy term or default RSS feeds by term?
Many contributed modules rely on Taxonomy-generating; for example, menus based on existing tags.
Guidelines for taxonomy design
Add a field to a taxonomy term (Drupal 7 and later)
Add a vocabulary to a content type
Using taxonomy URLs to display sets of content
Contributed modules for taxonomy and tagging
如果需要了解更多喂饥, 請點擊英文的鏈接, 如果想看中文就不吝打個賞吧肠鲫, 寫明需要看哪段员帮,謝謝!
Users, permissions, and roles
用戶與權限
Last updated April 20, 2016. Created on March 10, 2013.
Edited byavinashm,gdaw,chriscerk,mikenzig.Log in to edit this page.
Every visitor to your site, whether they have an account and log in or visit the site anonymously, is considered a user to Drupal. Every user also has a numeric user ID special to the type of user.
Types of Users
Master Administrator
This user has the ID one (1). User of ID one (1) is the primary admin user account created during Drupal installation. This user is very special because it has permission to do absolutely everything on the site.
Logged In
These users are assigned a user ID when they register for the website. A user name and email address is associated with any user that isn't anonymous (therefore must be logged in).
Anonymous
Anonymous users who visit the website but do not login all share a user ID of zero (0).
Associating more information with Users
Other information can also be associated with users by modules; for instance, if you use the core Profile module, you can define user profile fields to be associated with each user.
Permissions
Other users on your site can be assigned permissions via roles. To do this, you first need to create a role by navigating to people --> permissions --> role. A common role is "Content editor" or "Member". Next, you will assign permissions to that role, to tell Drupal what that role can and can't do on the site. Finally, you will grant certain users on your site your new role, which will mean that when those users are logged in, Drupal will let them do the actions you gave that role permission to do.
You can also assign permissions for the special built-in roles of "anonymous user" (a user who is not logged in) and "authenticated user" (a user who is logged in, with no special role assignments). Drupal permissions are quite flexible—you are allowed to assign permission for any task to any role, depending on the needs of your site.
Read more about this topic inThe Drupal Cookbook (for beginners).