如何从一开始就创建自定义的 drupal cms

Posted

技术标签:

【中文标题】如何从一开始就创建自定义的 drupal cms【英文标题】:How to create a custom drupal cms from starting 【发布时间】:2013-05-03 05:58:45 【问题描述】:

实际上,我需要知道每个 drupal 页面的页面内容是如何以及从哪里来的。所以我尝试将我自己的自定义主题集成到drupal。在教程中,他们说我需要创建一个自定义文件夹并将默认主题之一(如 garland/pushbutton)复制到该文件夹​​。我得到了正确的答案,但是当我检查这些模板中的文件和函数时,用于创建模板的函数是不同的。例如,在 pusbutton 主题中,我们没有 template.php,但在 garland 中,我们必须有一个 template.php 文件来显示内容。所以我很困惑,drupal 是否没有标准的方式或功能或文件来创建自定义模板?还有每一页的数据是怎么来的?

【问题讨论】:

【参考方案1】:

最好将现有的核心主题文件夹复制到 /sites/all/themes 中。 drupal 中的每个主题都彼此不同。例如使用template.php

For all the conditional logic and data processing of the output, there is the template.php file. It is not required, but to keep the .tpl.php files tidy it can be used to hold preprocessors for generating variables before they are merged with the markup inside .tpl.php files.

创建主题所需的唯一文件是 .info 文件。

了解更多关于How theme works的信息

【讨论】:

以上是关于如何从一开始就创建自定义的 drupal cms的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Drupal 8 中自定义/样式/主题自定义内容类型的输出?

Drupal 8 自定义块如何附加 JavaScript ?

如何在用户帐户上显示创建的自定义注册字段中的数据(Drupal 8)

如何仅基于用户角色 Drupal 自定义 drupal 过滤器

当自定义模板已应用于节点的内容类型时,如何在 Drupal 6 中自定义特定节点?

Drupal 自定义内容类型列表视图