创建新的 drupal 主题

发布于 2024-10-01 02:50:23 字数 233 浏览 4 评论 0原文

我知道 Zen 起始主题非常受欢迎,但我发现编辑其他人制作的主题更困难(即使它像 Zen 一样简单)在静态 html 中创建我自己的。从静态 html 设计开始然后将其移植到 drupal 是一个好主意吗?或者我只是无缘无故地做了两倍的工作?

我有兴趣听听其他更有经验的 Drupal 开发人员在设计新主题时会做什么。

I know that the Zen starting theme is very popular but I find it harder to edit a theme made by someone else (even if it's as simple as Zen) that to create my own in static html. Is it ever a good idea to start with a static html design and then port it over to drupal? Or am I just doing twice the work for no reason?

I'm interested in hearing what other, more experienced, drupal devs do when designing a new theme.

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

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

发布评论

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

评论(1

二智少女猫性小仙女 2024-10-08 02:50:23

就我个人而言,我永远不会手动编码所有 html 和 css,然后将其移植到 Drupal 主题。我不同意 Kevin 的观点“所有主题都以 html 开头”。请允许我引用我之前在 drupal.org 论坛上写的内容:

想象一下编写您自己的 html,其中包含 id 和类。您还可以编写 css 并使 css 选择器适应您自己创建的 html 结构、id 和类名。
接下来,当您必须将其转换为 Drupal 主题时,您会发现 Drupal 添加了它自己的 html 结构、id 和类名。这意味着您必须开始进行更改:要么更改 Drupal 输出以匹配您之前制作的模型,要么更改 css 选择器以匹配 Drupal 的 html 输出。不管怎样,你都是在做双重工作。只是效率不高。

在另一个主题我写道:

关于 Drupal 主题,您必须了解的一件事是,并非所有 xhtml/css/js 输出都是由主题生成的,因为模块提供了自己的默认输出。主题能够覆盖该输出,但在许多情况下没有理由这样做,因为默认输出通常是有效的、实用的且灵活的。如果您希望最终的 xhtml 输出与您创建的 xhtml 100% 相同,则必须覆盖每个主题函数和模板...现在这会浪费时间。

如果您习惯于编写静态 html,那么 Drupal 主题化可能需要改变心态。如果您想高效地使用 Drupal 主题,则必须学习使用默认的 html 输出。只要有可能,只使用 CSS。 入门主题,例如 禅宗创世纪Fusion 为构建您自己的自定义主题提供了良好的基础。

Personally, I would never hand-code all html and css and then port it to a Drupal theme. I don't agree with Kevin that "all themes start as html". Allow me to quote what I wrote before on the drupal.org forum:

Imagine writing your own html, complete with id's and classes. You also write css and adapt the css selectors to the html structure, id's and classnames you created yourself.
Next, when you have to turn that into a Drupal theme, you will find that Drupal adds it's own html structure, id's and classnames. This means that you will have to start making changes: either change the Drupal output to match the mockup you made earlier, or change the css selectors to match Drupal's html output. Either way, you're doing double work. It's just not efficient.

And in another topic I wrote:

One thing you have to understand about Drupal theming, is that not all xhtml/css/js output is generated by the theme, because modules provide their own default output. The theme is able to override that output, but in many cases there is no reason to do that because the default output is usually valid, functional and flexible. If you want the final xhtml output to be 100% identical to the xhtml you created, you will have to override every single theme function and template... now that would be a waste of time.

If you're used to writing static html, Drupal theming may require a change in mentality. If you want to be efficient in Drupal theming, you will have to learn to work with the default html output. Whenever possible, use only css. Starterthemes like Zen, Genesis and Fusion provide an excellent base to build your own custom theme.

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