第一部分 Drupal简介

作者: 王乂 | 来源:发表于2016-04-19 21:44 被阅读0次

    回首页

    第一部分 Drupal简介

    Drupal overview

    A tour of Drupal fundamental concepts. If you are completely new to Drupal, start here.

    Drupal的功能概念,如果你是第一次约Drupal,就从要电话开始吧。

    General concepts

    基本概念

    Content, content types, fields

    内容,内容类型和字段

    Build navigation with menus, toolbars

    用menu和toolbar做导航

    Building page layouts with content and blocks

    用内容和block(区块)建立页面布局

    Organizing content with taxonomies

    用分类组织内容

    Users and permissions

    用户与权限


    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.

    本章我们讨论一些对新手来说很有用的基本概念,如果需要更详细的内容,英语的点连接, 打赏的优先翻译。呵呵

    Node (Content)

    节点(内容)

    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中的节点意思是你网站的一段内容。而节点内容类型决定了内容里的字段(fields)。根据不同的节点,其实就是内容类型拉, 决定了什么样的字段将附加在内容里,这就是我们说的内容类型。举个例子,a basic Pages 这种内容类型的字段有title标题body正文,另外一些例子, 书中的书页,论坛里的讨论主题,博客里的博文,还有新闻等等。

    这里的node节点不是我们猿类所常说的那个网络节点哦。如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    Entity types

    实体类型

    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.

    一个实体类型是一组字段的有用抽象集合。实体类型一般用于存储或显示数据,有节点内容,评论, 分类字,用户资料,或是些开发者定义的东东。

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    Comment

    评论

    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.

    评论是你网站上另外一种内容类型,前提是你开启了核心自带的文章评论功能。 每个评论就像我们在百度贴吧那样跟在文章正文后面的评论。比如,在论坛里每句短小的文字跟在原论坛主题后面的就是评论。


    Taxonomy

    分类

    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有个专门用来分类内容的功能叫做分类。它是一个核心自带的功能。你可以定义你自己的字典(分类的组),也可以对每个字典添加术语。每个字典可以可以对应一个或者多个内容类型,这样的话,你网站上的节点Nodes可以按照归类,标签,是类型,或者随便什么你需要的方法来分类。

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    User

    用户

    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.

    用户是一种代表了真是世界中网站用户的实体。默认情况下,用户有一堆属性,除了用户名,密码,角色,Email地址等等外,还可以有其他的属性,可能是被其他的模块modules定义的,而且可以被添加,被扩展了新的字段。比如, 你可以添加新的链接字段链接到用户的Twitter账号地址。


    Module

    模块

    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)开发的Drupal新功能。模块主要被分为三种:

    核心模块Core,就是我们下好了drupal以后他自带默认的模块。这些模块可以被打开或者关闭,同时并不需要再额外的下载更多的组件。比如像博客,预定,投票,或者分类Taxonomy。

    贡献者模块是从Drupal官网上下载的,在你默认安装drupal的时候不能被自动装上的那些功能。如Panels模块和Views模块还有Metatag模块等等。

    自定义模块,是你自己写的模块。这需要深入的学习和理解drupal,PHP编程,和drupal的API接口。

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    Regions & Blocks

    区域和区块(我看大部分的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网站的页面布局是由区域Regions组成的。比如有头部,脚部,边栏或者主内容区域。你的主题可以定义额外的区域。

    而区块blocks,是一些相互独立的信息块,在你的网站上,这些区块blocks是显示在区域regions里面的。区块可以是一堆写好的静态HTML或者是text,或者是菜单(用来导航的,我们一般就叫做导航栏拉。),也可能是一些模块输出的内容,比如论坛最热文章排名,也可能是你自定义的动态列表,比如一些时间记录的菜单。


    Menus

    菜单

    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中标准的菜单:

    主菜单是网站管理员建立的,并且自动显示在主页的头部的导航菜单,如果没有的话, 你也可以开启区块去显示这个导航栏菜单。

    管理菜单是网站管理员使用的,显示在admin toolbar里。

    导航菜单是一揽子的菜单,一般情况下它是由你网站的模块给出的。

    用户菜单包含了用户账户的连接和注销。

    你当然也可以使用自己定制的菜单项,并且在开启它所在的区块(blocks)以后, 就可以看到它了。

    你有许多种方法来定制menus,比如可以通过定义权重weight来重新为菜单项排序,或者就是简单的通过鼠标拖动到一个你想要的顺序,重命名菜单的项目,更换链接名字,或者更换菜单项的title属性,就是鼠标放上去显示出一行注解一样的小字的那个。你也可以通过修改菜单项的父类属性从而实现把一个菜单里的项目移动到另外的一个项目中去。

    当然你也可以增加定制的菜单到另一个菜单里,从管理员账号的屏幕比普通用户的账号看到的会多。如果创建导航栏的话, 那你必须知道链接正确内容的路径PATH。

    在项目中, 菜单里的项目只给被授权的用户看到。比如, 如果没有登陆的话, admin菜单是不能被看到的。


    Theme

    主题

    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.

    主题层,和数据层,和功能扩展层(就是模块module)和核心是相互分离的。(MVC思想的体现)主题控制网站的展现(视觉上的和体验上的),或者控制你网站是怎么显示的,包括图片的显示,布局的显示,颜色的显示。主题由一个或者多个PHP模版文件构成,(在Drupal8中被更好的Twig模版实现)这些模版定义了被输出的HTML文件以及与HTML文件配套的CSS文件,而CSS文件定义了布局,字体,颜色和其他的样式。

    在Drupal的官网有多种主题可选, 具体看链接拉。

    又来这句话了,反感的请忽略,^_^    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    Views

    视图

    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中,视图模块被默认的添加到了核心里。视图模块可以用来选择节点的列表,或者其他的实体并把他们展现成页面,区块,RSS种子,或者其他的任何形式。视图的主要功能是根据内容的属性(拿新闻来举例,内容类型是新闻按照发布时间排序(很像SQL的查询语句吧^_^))生成动态更新的内容列表 ,(比如,最新新闻的列表),


    Database

    数据

    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通过数据库保存数据。在Drupal的数据库里, 每一种信息都有它自己的数据库表。比如:节点的基本信息被存储在节点表里,每个字段在另外一张表存储它的数据,而且是自动创建的表。评论和用户也有他们自己的表,比如规则, 权限或者其他的设置。

    最常使用的数据库是MySQL。当然了, 你也可以在别的SQL数据库上正常运行drupal, 像是PostgreSQL一类的。


    Path

    路径 (备注下, 先这样叫把, 后面还 有个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.

    当你通过浏览器访问网页的时候, 那个地址栏里域名后面的就叫路径Path。

    当你访问一个页面时,Drupal会检查它的菜单项menu items和路由routes。通常,Drupal允许每个模块定义它响应哪些路径,当你访问的时候,Drupal会查询模块应该显示那些内容在页面上。

    比如你在访问这个地址http://drupal.org/node/19828 ,这个地址的路径是“node/19828”。负责这个地址的模块是核心的节点模块。所以当你访问这个地址的时候, drupal会让节点模块决定把哪些内容显示给你。


    Bootstrap

    此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(中央处理单元)。在其他的软件环境,这个东西往往被称为事件循环。Drupal的核心就有点像这个东西,(从方法上来讲,确实和我们用的电脑CPU有点像)当一个路径Path请求到达的时候,它就开始处理。


    Permissions

    权限

    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.

    权限是用来定义哪些用户可以干啥的, 比如哪些内容可以给哪些用户看, 或者哪些内容可以给哪些用户编辑。这些权限是对应注册用户和非注册用户说的。权限可以定义的很特殊或者粒度很小,这样它在网站结构建设的时候就可以发挥强大的作用。


    内容,内容类型和字段

    Content, content types, fields

    Working with nodes, content types and fields

    What is a node?

    什么是节点呢?

    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站点里所有的内容被当做是节点来存储。节点也可以是一个内容类型。节点也可以是任何的单独内容的一部分,像是页面,用户,投票,文章,论坛话题,或者是博客条目。

    Why nodes?

    为什么用节点?

    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.

    把所有的内容当成是节点,可以增加创造新内容类型的弹性。也允许你几乎没有痛苦的为一种内容类型添加特性。评论从来都会被当成是节点来存储,但是它总是关联到一个节点上。

    Working with nodes

    使用节点

    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.

    一个节点有很多的字段,你可以自定义字段或者定义你自己的内容类型。当你安装模块的时候, 系统会增加很多的字段(像是日期,时间,邮寄地址,图片,文件,URL,或者是地理信息)和很多字段,在Drupal7中是在内容管理功能里设置的。

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!

    About nodes

    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.

    菜单是链接(菜单项)的合集,用来为网站导航。drupal有个菜单模块提供了可视化的控制和编辑的强大功能。通过灵活的区块功能,菜单可以被显示为有层次的链接列表。每个菜单自动生成同名的区块。默认情况下,新的菜单项被放置在导航菜单,不过管理员也可以创建自定义的菜单。

    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里,你可以添加,删除重命名菜单和菜单项,或者菜单表。你也可以为菜单配置一个特殊的区块,你还可以设置一个默认的菜单,这样新增的菜单项将被自动添加到里面。

    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.

    许多主题有至少两个菜单,一个主菜单,一个辅菜单。主菜单提供主要的导航结构,经常显示在网页的头部或者边栏,辅菜单一般用于版权和隐私的注释。他们经常可以在网页的最底部或者非常靠头部的用非常小的字体写成。

    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.

    当你在网站上发布内容的时候,你也可以定制内容的菜单项。你可以定义一个默认的内容作者表单。

    Each default or custom menu has a corresponding block. For more information on blocks, seeWorking with Blocks.

    每个默认的或者定制的菜单都有对应的区块。

    Configuration 配置

    Creating a menu 创建菜单


    创建菜单

    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.

    假设你想添加你的节点nodes到你的菜单而且不是网站外部的链接,你必须为这些想设置到菜单里的节点开启内容类型。

    开启菜单

    Navigate to the content type for the node(s) (Structure > Content typeorhttp://example.com/admin/structure/types).

    导航到节点的内容类型,结构-》内容类型,或者是链接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这个主题里,有可能会出现不按照扩展菜单改显示的样子来显示。但是你可以把菜单放到其他的区域中,试试看能不能看到我们希望的扩展菜单的效果。这个需要注意下的就是有的时候有些主题并不能完全按照规则来正确显示。

    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.

    Adding a link to a menu

    Using named anchors with Menus

    Menu Options and Visibility in the Content authoring form

    Menu HowTos

    Comparison of various drop down menus

    Contributed modules for menus

    Custom Menu Links - Enables users to create menu links.


    Building page layouts with content and blocks

    用内容和block(区块)建立页面布局

    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.

    区块就是内容盒子,比如用户登录盒子或者在线盒子,区块显示在区域中,像是底部,或者边栏。

    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.

    区块可用最常见的方式是开启了某些模块。一旦区块被创建,可以修改调整它的属性,比如显示,形状,大小和位置,或者是显示在哪些页面。比如开启了核心里的投票模块,那个最近投票的区块就生效了,当然了很多模块生成不只一个的区块, 也有的模块并不生成任何的区块。

    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.

    当你点击配置区块的时候你可以编辑区块的内容,处理可视化的设置,甚至改变它在你主题的位置。

    Blocks are placed in regions via the Block Admin pageAdminister > Site building > Blocks(Drupal 6),Dashboard > Structure > Blocks(Drupal 7).

    区块在区域内, 通过控制面板,结构,区块来配置。

    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.

    你的站点主题定义了区域,区块的位置通过主题的区块管理页面配置。如果你有多于一个的主题, 你可以在每个主题里定义区块的位置。

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!

    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.

    区块管理也允许在主题区域内定义垂直排序,在Drupal6以后就允许通过拖动来实现了,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:

    区块管理也提供了一种选择框,(看你Drupal的版本和你使用的模块了。)也是设置链接, 进到设置页面, 就可以可视化的配置区块了。一个区块的可视化取决于:

    Whether it isEnabledand assigned to a region. Disabled blocks (blocks not assigned to any region in your theme) are never shown.

    区块是否启用别切被分配了区域,没有启用,或者没有分配给任何区域的主题是显示不出来的。

    TheThrottlecheckbox (if you have the Throttle module enabled). Throttled blocks are hidden during high server loads.

    节流选择(如果你开启了节流模块,)那么这个模块在服务器负载高的时候是不可见的。

    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.

    页面—特殊 可视化 设置。有些特殊的区块会被设置成只显示或者不显示在某些页面。

    Custom visibility settings. Individual blocks can be configured so that users decide whether to show/hide certain blocks.

    定制可视化设置,有些区块可以被设置成由用户决定是否显示。

    Its function. Dynamic blocks (such as those defined by modules) may be empty on certain pages and will not be shown.

    还有些区块,(比如在某些模块里定义的)可能是空的, 并且不会被显示出来 。

    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.

    在区块管理页面也有个“添加区块”的链接,这个功能让你可以定义一个区块的内容,每个管理员定义的区块有一个标题, 一个描述和一个正文组成,当然就像你想要的那样, Drupal引擎会渲染这个区块的内容。

    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.

    需要注意的是如果你的区块非常的多, 通常是超过100个, 有可能需要在php.ini里增加 increasemax_input_varsin 这个参数。

    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.

    Block HowTos

    Blocks outside sidebars

    Blocktable

    Dynamic display block

    Link block titles

    Managing custom blocks

    Multi block module

    MultiBlock - Multiple instances of a block

    Nodeblock: Use nodes as blocks

    Promos Documentation

    Working with Boxes

    Working with Custom Blocks

    Block Content Per Role

    如果需要了解更多, 请点击英文的链接, 如果想看中文就不吝打个赏吧, 写明需要看哪段,谢谢!


    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.

    分类是一个核心自带的一个非常强大的模块, 它提供了组织关键字的作用在其他的类似系统里经常被称为categories,tags,或者是metadata,它让你可以连接, 关联,或者归类你网站的内容,在Drupal里, 所有的这些词统一被称为Vocabularies,字典,而分类模块则允许你创建, 管理和生效所有的这些字典。

    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.

    分类可以用于工作流,它可以定制你网站定义的部分在不同的主题都生效, 或者显示按照分类条款制定的内容。 当然了分类还可以有很多种 用法。

    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.

    About taxonomies

    Guidelines for taxonomy design

    Create a vocabulary

    Add a term to a vocabulary

    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).

    相关文章

      网友评论

        本文标题:第一部分 Drupal简介

        本文链接:https://www.haomeiwen.com/subject/rprzlttx.html