如何将 CCK 表单和视图合并到 Drupal 中的单个页面中
使用 Drupal 6。
我使用 CCK 创建了一种新的节点类型,它有一个文本形式的表单字段,限制为 120 个字符。标题被node_autotitles模块隐藏,正文通过在节点设置中删除body字段名称来删除。
我还有一个在页面视图上显示此类型的所有节点的视图。
我想做的是整合一些内容,以便用户可以在视图页面上填写此节点表单,并刷新它或类似的内容,以便他们可以看到更新的页面。我想它就像一个喊话箱,但我不想为所有这些安装新模块,我想看看如何使用我创建的模块。
有什么想法吗?
Using Drupal 6.
I've created a new node type with CCK, which has one form field, in text, limited to 120 characters. The title is hidden by the node_autotitles module, and the body is removed by removing the body field name in the node settings.
I also have a view that displays all nodes of this type on a page view.
What I would like to do is consolidate things so that the user can fill in this node form on the view page, and have it refresh or something similar so they can see the updated page. I guess it's like a shoutbox, but I don't want to install a new module for all of this, I would like to see how it's possible using what I've created.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以通过块来完成。
创建一些页面,比如说shoutbox,然后创建2个块并将它们放入content或content_bottom区域(这取决于你的主题)。
在第一个块输出形式中使用自定义 php 代码
在第二个中,显示带有节点的视图。
you can do it via blocks.
create some page, let's say shoutbox, then create 2 blocks and put them to content or content_bottom region (it depends on your theme).
in first block output form using custom php code
in second one, display your view with nodes.
您可以使用 formblock 模块来实现此目的,将节点创建表单放在视图页面中。
为了将表单放入您的视图中,您可以使用上下文、面板或您正在使用的任何内容。或者只是创建一个模块,然后使用
hook_views_prerender
和drupal_get_form
将表单放入视图的#prefix
中。You can use the formblock module for achieving this, putting the node creation form in your view page.
For putting the form in your view, you can use context, panels, o whatever you're using. Or just create a module and put the form in the
#prefix
of the view withhook_views_prerender
anddrupal_get_form
.