Drupal:高级主题的模板文件、模块和内容类型

发布于 2024-08-24 20:12:15 字数 1017 浏览 5 评论 0原文

简介

我正在尝试将我的第一个 HTML/CSS 设计转换为 Drupal 的主题。我已经使用 ModX 进行了相当多的设计,并且很欣赏创建不同页面模板和分配给这些模板的自定义变量的能力。然而,我在过渡过程中似乎遇到了一些问题。

我正在 Drupal 中为房地产经纪人开发主题的网站。每个页面/部分都有一组不同的与之关联的内容,并且只需要显示该内容。例如,将有一个当前列表的页面,每个页面都将按自定义内容类型进行格式化。但是,当我调用主页(或其他页面)上的内容时,我不想看到此列表数据。


布局

网站的布局以及与每个页面/部分相关的区域如下:

  • 首页
    • 聚焦
    • 精选 1
    • 精选 2
  • 关于
    • 聚焦
    • Bios - 页面上列出的每个代理的个人资料(每个代理都是一个带有姓名、联系信息、图片等的节点);列出多个节点
    • 侧边栏
  • 列表
    • 聚焦
    • 列表 - 页面上列出的属性简介(每个属性都是一个包含位置、基本信息、图片等的节点);列出多个节点
    • 侧边栏
  • 服务的
    • 聚焦
    • 内容 - 一般段落文本区域
    • 侧边栏
    • 新闻/博客
    • 新闻/博客项目 - 包含摘要和全文链接的故事列表
    • 侧边栏

每个页面/部分将使用相同的页眉和页脚。


问题

我已经阅读了一些关于 Drupal、自定义内容类型(和 CCK)、视图和 Pathauto 的内容。然而,我无法清楚地了解如何将它们组合在一起来完成我正在尝试的事情。我真正想知道的是要使用哪些模块,如何最好地使用它们,我需要在哪里使用哪些元素,以及我应该使用哪些模板文件来主题化我需要使用的元素。任何帮助或参考有用资源将不胜感激。

Intro

I am in the process of trying to convert my first HTML/CSS design into a theme for Drupal. I have used ModX for quite a few designs and appreciate the ability to create different page templates and custom variables to be assigned to those templates. However I seem to be having some issues making the transition.

The site I am working on theming in Drupal is for a real estate agent. Each page/section will have a different set of content associated with it and will need to display only that content. For example, there will be a page for current listings, each of which will be formatted by a custom content type. However, when I call the content on the home page (or on other pages) I do not want to see this listing data.

Layout

The layout of the site and the regions associated with each page/section is as follows:

  • Home
    • Spotlight
    • Featured 1
    • Featured 2
  • About
    • Spotlight
    • Bios - Profiles of each agent (each will be a node with name, contact info, pic, etc) listed on the page; multiple nodes listed
    • Sidebar
  • Listings
    • Spotlight
    • Listings - Profiles of properties (each will be a node with locations, basic info, pic, etc) listed on the page; multiple nodes listed
    • Sidebar
  • Services
    • Spotlight
    • Content - general paragraph text area
    • Sidebar
    • News/Blog
    • News/Blog Items - List of stories with summaries and links to full article
    • Sidebar

Each page/section will use the same header and footer.

Issue

I have done some reading on Drupal, custom content types (and CCK), Views, and Pathauto. However I have not been able to get a clear picture of how to put it all together to accomplish what I am attempting. What I really would like to know is which modules to use, how best to use them, which elements I need to use where, and what template files I should be using to theme the elements I need to use. Any help or reference to useful resources would be much appreciated.

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

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

发布评论

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

评论(2

花之痕靓丽 2024-08-31 20:12:15

这是一个相当普遍的问题,您的描述对于页面与网站部分与页面区域等重要区别有些模糊。也就是说,一些一般建议:首先安装管理模块。然后,在开始做任何自己的主题之前,通常将所有内容放在与其他人的主题(例如 Garland)正确的位置。您应该能够在不接触代码的情况下取得很大的进展。使用 CCK 定义您的内容结构。您应该已经有一个页面类型,听起来您需要添加一个功能、简介、列表和博客文章类型。根据详细信息,您可能需要添加一些额外的字段模块,例如,如果您有图像,您可能需要 imagefield 模块。

定义内容类型后,配置 pathauto,然后开始添加内容。

一旦您拥有了一些内容,您将需要创建一些带有视图的列表。您可能想从 simpleviews 模块开始,因为视图 ​​UI 可能会让人不知所措。将您的视图保存为块显示,然后使用块管理将其放入右侧页面区域,并将它们配置为仅显示在右侧页面上。

此时,您将需要开始控制各个项目(节点)在不同上下文中的外观。那就是你开始主题化的时候。为此,我将安装 devel 模块,查看其他主题的功能,并对您不理解的任何变量调用 dsm() 以查看它们的外观。

通常,您可以在 Drupal IRC 频道 上获得有关特定问题的快速帮助。

This is a rather general question, and your description is a kind of vague on important distinctions like page vs. site section vs. page region. That said, some general advice: start by installing the admin module. Then get all your content generally in the right places with someone else's theme, e.g. Garland, before you start doing any of your own theming. You should be able to get pretty far without touching code. Use CCK to define your content structure. You should already have a type for page and it sounds like you'll want to add a type for feature, bio, listing, and blog post. Depending on the details, you may need to add some additional field modules, e.g. if you have images, you'll probably want the imagefield module.

Once you have the content types defined, configure pathauto, and start adding content.

Once you have some content, you'll want to create some lists of it with views. You may want to start with the simpleviews module, as the views UI can be overwhelming. Save your views as block display, and then use the blocks admin to put the in the right page region, and configure them to show up only on the right pages.

At that point, you'll want to start controlling how the individual items (nodes) look in different contexts. That's when you start theming. For that, I'd install the devel module, look at what other themes do, and call dsm() on any variables you don't understand to see what they look like.

You can generally get quick help with specific questions on the Drupal IRC channels.

甜柠檬 2024-08-31 20:12:15

执行您想要执行的操作的最简单方法可能是将自定义内容放入块中,并将块的访问设置设置为仅在某些页面上。因此,例如,如果您希望在 /spotlight 或 /node/22 等位置显示内容,您只需创建一个自定义块(站点构建 -> 块),然后在设置中将该块设置为仅显示该节点。

The easiest way to do what you want to do may be to put your custom content in blocks and set the access settings for the blocks to be only on certain pages. So, for instance if you have content that you want to appear at /spotlight or /node/22 or such, you would just create a custom block (Site Building -> Blocks) and then in the settings, set the block to only show for that node.

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