创建自定义联系页面 -- page-contact.tpl.php

发布于 2024-10-09 04:01:01 字数 216 浏览 0 评论 0原文

我是 Drupal 的新手。我想创建一个联系页面,因此我复制了 page.tpl.php 并将其重命名为 page-contact.tpl.php。我在页面中创建了一些新元素,因此我可以看到,如果单击“联系”链接,我就会知道我访问了正确的页面。

现在我没有看到任何变化。我错过了什么吗?我是否需要在管理设置中执行某些操作,以便 Drupal 知道我需要打开哪个文件?

我也尝试清除缓存。

I'm new to Drupal. I want to create a contact page, so I copied page.tpl.php and renamed it to page-contact.tpl.php. I created some new elements in the page, so I can see that if I click on the "contact" link, I'll know that I went to the correct page.

Right now I don't see any change. Was there something I missed? Do I need to do something in the admin settings so Drupal knows which file I need to open?

I also tried clearing my cache.

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

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

发布评论

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

评论(3

从理论上讲,这是一种有效的方法。问题是,您可以通过这种方式为联系页面创建新的布局,但不一定要更改联系表单。如果您也想更改表单,我建议使用 webform 模块。在创建联系表单时它非常灵活,此外,它还创建了一个节点,因此您可以轻松地对其进行样式设置(无论是在标准 node.tpl.php 中,还是更好 - 在 node-webform.tpl.php)。这就是我通常做的事情。

可能还有其他解决方案,但如果您明确希望在联系页面中引入哪种更改,将会有所帮助。

In theory, this is a valid approach. Problem is, you'll be able to create a new layout for your contact page this way, but not necessarily change the contact form. If you wish to alter the form as well, I'd recommend using the webform module. It's pretty flexible when it comes to creating contact forms, plus, it creates a node, so you can style it with ease (either in you standard node.tpl.php or - even better - in node-webform.tpl.php). This is what I usually do.

There might be other solutions too, but it would help if you made it clear what kind of alterations you wish to introduce in your contact page.

独﹏钓一江月 2024-10-16 04:01:01

当你说清除我的缓存时,你指的是浏览器缓存还是drupal的缓存?确保 drupal 的主题注册表已通过转至 /admin/build/themes 或注销并重新登录来清除。

我还建议尝试 webform 模块,如 mingos 所建议。

When you say cleared my cache do you mean the browser cache or drupal's cache? Ensure drupal's theme registry has been cleared by going to /admin/build/themes, or logging out and back in.

I also recommend trying the webform module as mingos suggests.

睡美人的小仙女 2024-10-16 04:01:01

Drupal 核心的内置联系人模块不使用任何模板,因此如果您想要每个联系人模板,则必须使用 Webform 之类的东西。

Drupal core's built in contact module does not use any templates, so you'll have to use something like Webform if you want a per-contact template.

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