drupal 中的视图模块

发布于 2024-10-17 08:32:16 字数 26 浏览 2 评论 0原文

Drupal 中视图模块的用途是什么?

What are the uses of views module in Drupal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

温柔女人霸气范 2024-10-24 08:32:16

在最基本的层面上,视图是一个查询生成器。但它的作用远不止于此,因为它允许您管理查询结果的输出并将它们设置为页面、块、提要或可以使用其他模块扩展的任何其他数量的输出选项。

Views 是 Drupal 社区中使用最频繁的模块之一。据报道,目前有 270,290 个活动站点安装了该软件。

项目页面中使用视图的一些示例:

  • 您喜欢默认的首页视图,但您发现想要对其进行不同的排序。
  • 您喜欢默认的分类/术语视图,但您发现想要对其进行不同的排序;例如,按字母顺序排列。
  • 您使用 /tracker,但希望将其限制为特定类型的帖子。
  • 您喜欢“文章”模块的想法,但它不会按照您喜欢的方式显示文章。
  • 您想要一种方法来显示包含某种特定类型的最新 5 篇帖子的块。
  • 您想要提供“未读的论坛帖子”。
  • 您想要一个类似于典型 Movable Type/Wordpress 存档的每月存档,该存档以“月,YYYY (X)”的形式显示链接,其中 X 是该月的帖子数,并以堵塞。这些链接指向该月的帖子的简单列表。

At its most basic level, Views is a query builder. It does much more than this though as it allows you to manage the output of your query results and set them up as pages, blocks, feeds, or any other number of output options that can be extended with other modules.

Views is one of the most heavily used modules in the Drupal community. It is currently reported as installed on 270,290 active sites.

Some examples of uses of Views from its project page:

  • You like the default front page view, but you find you want to sort it differently.
  • You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
  • You use /tracker, but you want to restrict it to posts of a certain type.
  • You like the idea of the 'article' module, but it doesn't display articles the way you like.
  • You want a way to display a block with the 5 most recent posts of some particular type.
  • You want to provide 'unread forum posts'.
  • You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of "Month, YYYY (X)" where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month.
好倦 2024-10-24 08:32:16

我通常将其描述为“可视化查询生成器”,例如 user247245。在更简单的层面上,每当您需要站点中的数据“对象”(或其子组件)列表(无论是内容、用户、评论等)时,视图都非常有用。

视图可以像单个项目一样简单;例如,如果您想将一个特色故事随机插入到每个页面侧边栏的块中。视图允许您添加过滤器(按创建日期、按分类术语等)、指定显示(块、页面等)以及对输出进行主题化(在显示级别、行级别等)。

视图的许多功能源于它与许多其他模块集成的事实。它与 CCK 相得益彰,允许您根据需要灵活地输出 CCK 字段。还有许多其他模块添加了额外的显示类型,例如 lightbox 幻灯片、“手风琴", CSV导出JSON 输出轮播日历等。

简而言之,如果如果您计划使用 Drupal,那么花时间学习使用视图将是值得的。

I usually describe is as a "visual query builder", like user247245. On a simpler level, Views can be useful any time you need a list of data "objects" (or their sub-components) from your site (whether content, users, comments, etc.).

A view can be as simple as a single item; for instance, if you want to have a featured story randomly inserted into a block on the sidebar of every page. Views lets you add filters (by date created, by taxonomy term, etc.), designate displays (block, page, etc.), and theme the output (at the display level, at the row level, etc).

A lot of the power of Views stems from the fact that it integrates with lots of other modules. It compliments CCK especially well, by allowing you to flexibly output CCK fields, as needed. And there are lots of other modules that add additional display types, such as lightbox slideshows, "accordions", CSV exports, JSON output, carousels, calendar, etc.

In short, if you plan to use Drupal, time spent learning to use Views will be time well spent.

海未深 2024-10-24 08:32:16

它是一个可视化的“查询构建工具”,使您能够获取数据(节点)。

可以将其视为“重新发明”的 SQL。

It's a visual "query building tool", giving you the ability to fetch data (nodes).

Think of it as SQL "reinvented".

冰雪梦之恋 2024-10-24 08:32:16

在更基本的层面上,您可以使用视图来创建页面或列表块。例如,带有标题和预告片的缩略图列表、用户列表、评论列表等。视图扩展了基本的 mysql 查询和获取行,因为您可以格式化行和字段的显示以满足您的需要。

On an even more basic level, you use Views to creates pages or blocks of lists. Like, lists of thumbnails with headlines and teasers, lists of users, lists of comments, and etc. Views extends making basic mysql querys and fetching rows, because you can format the display of the rows and fields to suit your needs.

Joe

生生漫 2024-10-24 08:32:16

根据我的说法,无法在其他内容类型页面上显示一种内容类型的内容。但是通过使用视图,您可以非常轻松地做到这一点。您只需添加分类术语,并在此基础上您可以非常轻松地显示它。您只需要创建适当的关系,并为其应用上下文过滤器。

例如,

您有两种内容类型:
1.页面,
2.博客条目

现在如果想将页面相关的博客以块的形式显示在页面上那么除了创建视图之外没有其他办法了。这是一种非常简单的方法。

According to me there is no way to display one content type's contents on other content type page.. But by using views you can do it very easily.. You just have to add taxonomy terms and based on that you can display it very easily. You just have to create a proper relationship and have to apply the contexual filter for it..

e.g.

You have two content type :
1.Page,
2.Blog Entry

now if you want to display the page related blog on the page as a block then there is not other way than creating a view. and its a very simple way to do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文