Drupal Webform 进入首页模板

发布于 2024-12-24 16:58:23 字数 236 浏览 3 评论 0 原文

我需要向我的 page-home.tpl 添加一个 Web 表单,但我对 Drupal 还很陌生,所以我需要一个非常明确的帮助...

我正在使用 DRUPAL 6 并且我已经创建了 Web 表单。

我想将 Web 表单添加到我的自定义模板中,只需将 php 代码添加到 tpl 文件中即可。我的网络表单 ID 是 id="webform-client-form-20"。

你能帮助我吗 ?

多谢

I need to add a webform to my page-home.tpl but I'm really new on Drupal so I need a really clear help...

I'm using DRUPAL 6 and I have created the webform.

I would like to add the webform to my custom template just adding the php code to the tpl file. My webform id is id="webform-client-form-20".

Can you help me ?

Thanks a lot

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

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

发布评论

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

评论(1

烈酒灼喉 2024-12-31 16:58:23

最快(不一定是最好)的方法是使用 node_view()node_load()< /a>:

$nid = 20; // Node ID of the webform.
$webform_node = node_load($nid);
echo node_view($webform_node);

最好将其加载到预处理函数中的变量中,而不是直接在主题中输出,但这应该适合您的目的。

The quickest (not necessarily best) way to do it is using a combination of node_view() and node_load():

$nid = 20; // Node ID of the webform.
$webform_node = node_load($nid);
echo node_view($webform_node);

You'd be better off loading that into a variable in a preprocess function than outputting it directly in the theme but this should work for your purposes.

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