问题标签 [drupal-templates]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1526 浏览

drupal-7 - Drupal 7 视图模板覆盖输出原始值

我有一个包含 2 个字段的视图:

[field_services_color]&[field_services_cover]

这些输出很好,但我需要用模板覆盖来覆盖输出。

我有这个覆盖:views-view-fields--services.tpl.php

其中有这个代码:

哪个输出:

但我需要这样做:

我已经在 Google 上寻找了几个小时的解决方案,但找不到任何解决方案。这可以做到吗?

我确实尝试在具有重写输出的视图中执行此操作,这似乎是最简单的方法,但由于某种原因,drupal 剥离了样式属性。

对此的任何帮助将不胜感激。

C

0 投票
0 回答
3464 浏览

drupal-7 - Drupal 7 如何将自定义模板应用于我的自定义表单

我有一个模块,其中包括多步表单。我决定让这些步骤之一像这样工作:每个员工的空闲时间呈现为 html 元素,当单击元素时,Javascript 会将值应用于隐藏的输入字段。

所以我找到了这个教程:http ://drupal.org/node/1092122但它对我不起作用,也许我犯了一个错误,也许不是。

我的模块名称是预订。我的模板文件名为reservation_select_time_week_page.tpl.php,它位于reservation/theme 文件夹中。

我有这些功能:

我不知道哪些预处理函数是正确的(应该根据模板名称还是表单 ID 命名?

无论如何,自定义模板不适用。

我也尝试过使用:

我得到了它的工作,以便在模板文件中呈现静态 html,但我不知道如何在模板文件中呈现表单元素。使用:

我认为导致表单进入无限循环。

Drupal 甚至能够处理复杂的表单和表单布局吗?

0 投票
1 回答
667 浏览

drupal - 用于首页的内置 Drupal RSS 提要:它使用什么 tpl.php?

一些快速测试确认 Drupal 7 中的首页 RSS 提要没有使用 views-view-rss.tpl.php 或 views-view-row-rss.tpl.php。

你能告诉我 Drual 使用哪个模板作为内置的首页 RSS 提要吗?

我知道通过 Views 模块创建自定义 RSS 提要的能力。我专门寻找关于首页 RSS 提要的信息,而不是在 Views 中创建的自定义提要。

在此先感谢您的时间。

0 投票
1 回答
328 浏览

php - Drupal 7:未加载适当的页面模板

该页面的路径别名是 /annual-reports/2012。我在主题 template.php 文件中设置了以下内容:

当我加载页面时,它没有加载正确的模板。如果您注意到我将建议数组输出到评论以确保建议适当的模板。它输出以下内容:

我有一个名为 page--annual-reports--%.tpl.php 的模板文件。然而,它正在加载基本页面--node.tpl.php。我错过了什么?

0 投票
2 回答
385 浏览

drupal-7 - Custom Content Regions for a Drupal 7 Home Page

I am developing a Drupal 7 site with a home page that consists of 5 regions. Each region will need to be editable within the Drupal admin system. Each region at a minimum will need to have an image upload and a text/body field. There may be other additional fields for certain regions. In other words not all of these regions will need the exact same fields.

I am not sure what the best way to set this up in Drupal is. I looked at Blocks but they don't have the ability to customize the fields. And I need my image field to be separate because it will be used as a background image for the region, not displayed inline.

I considered creating a custom content type but I wouldn't want the content editors to be able to create multiple nodes for a given region which would likely cause confusion.

I did see a module Node Limit that seems to limit the number of nodes that can exist for a user or content type but it is still listed as an alpha module.

What have you done to deal with a similar situation?

0 投票
1 回答
286 浏览

drupal-7 - 如何为父子分类术语创建单独的 Drupal 模板?

我有一个复杂的产品类别分类层次结构。

每个主要分类术语至少有一个子术语。其中一些子术语具有子术语。所以在某些地方,分类树是一层深,而在其他地方它是两层深。

我需要根据级别为分类术语创建两个单独的 Drupal 模板。

我已经使用视图为顶层创建了一个自定义模板。

我试图弄清楚如何使用自定义模板动态呈现分类术语,具体取决于它是处于第 1 级还是第 2 级。

我猜我需要使用模板预处理功能?

这是解决这个问题的最好方法吗?

0 投票
1 回答
692 浏览

drupal-7 - 登录表单中登录按钮的“属性”

我需要为登录表单设置主题。我需要为表单元素添加额外的 css 类和 tabindex。

现在我对登录按钮都有问题。

在 template.php 中,我为此使用了“属性”。例如,密码字段与此代码完美搭配:

当我将它用于按钮时 - html 中不会呈现任何内容:

'op' 是我可以在 html 输出中看到的登录按钮的名称。

如何获取登录按钮的“类”和“标签索引”?

0 投票
1 回答
1372 浏览

drupal-7 - Drupal 7 Views with custom template exposed filters doesn't showing

I have a view and customize it with a template named views-view--myviewname--page.tpl.php. My problem is that exposed filters doesn't showing when loading the page. But in preview in view editing screen showing as expected. Is there a solution about this issue?

Thanks in advance

0 投票
1 回答
1891 浏览

drupal-7 - drupal 7 自定义用户配置文件模板无法保存更改

我想自定义我的用户个人资料编辑页面。编辑路径为:xxx/user/2/edit 1.在我的模板文件中:

在我的 user-profile-form.tpl.php 文件中:

现在表单看起来像预期的那样,但是,当我更改密码时,没有错误,但我无法使用新密码登录。我又测试了一下,好像只有administrator才能改,认证用户不能改自己的密码。

0 投票
1 回答
1653 浏览

drupal - Drupal页脚模板?

我应该如何在我的子主题中命名页脚模板文件以使其与其他模板文件中的此类语句一起使用?

(我正在使用面板,但也许这与这里无关。)